mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hrushiraj Gandhi <hrushirajg23@gmail.com>
To: conor.dooley@microchip.com, daire.mcnamara@microchip.com
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Hrushiraj Gandhi <hrushirajg23@gmail.com>
Subject: [PATCH] firmware: microchip: use kzalloc_objs() instead of kzalloc() with multiply
Date: Tue,  1 Sep 2026 12:59:50 +0530	[thread overview]
Message-ID: <20260901072951.525569-1-hrushirajg23@gmail.com> (raw)

response_msg is sized as
AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(*response_msg) by hand in both
call sites. Use kzalloc_objs() instead, matching the kzalloc_obj()
already used elsewhere in this same file for the other allocations in
these functions, and getting the same overflow-checked size
computation kzalloc_obj() already benefits from.

No functional change.

Signed-off-by: Hrushiraj Gandhi <hrushirajg23@gmail.com>
---
 drivers/firmware/microchip/mpfs-auto-update.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
index 1211fd8d0463..b97d34bd2354 100644
--- a/drivers/firmware/microchip/mpfs-auto-update.c
+++ b/drivers/firmware/microchip/mpfs-auto-update.c
@@ -156,7 +156,7 @@ static int mpfs_auto_update_verify_image(struct fw_upload *fw_uploader)
 {
 	struct mpfs_auto_update_priv *priv = fw_uploader->dd_handle;
 	u32 *response_msg __free(kfree) =
-		kzalloc(AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(*response_msg), GFP_KERNEL);
+		kzalloc_objs(*response_msg, AUTO_UPDATE_FEATURE_RESP_SIZE);
 	struct mpfs_mss_response *response __free(kfree) =
 		kzalloc_obj(struct mpfs_mss_response);
 	struct mpfs_mss_msg *message __free(kfree) =
@@ -358,7 +358,7 @@ static const struct fw_upload_ops mpfs_auto_update_ops = {
 static int mpfs_auto_update_available(struct mpfs_auto_update_priv *priv)
 {
 	u32 *response_msg __free(kfree) =
-		kzalloc(AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(*response_msg), GFP_KERNEL);
+		kzalloc_objs(*response_msg, AUTO_UPDATE_FEATURE_RESP_SIZE);
 	struct mpfs_mss_response *response __free(kfree) =
 		kzalloc_obj(struct mpfs_mss_response);
 	struct mpfs_mss_msg *message __free(kfree) =

                 reply	other threads:[~2026-09-01  7:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260901072951.525569-1-hrushirajg23@gmail.com \
    --to=hrushirajg23@gmail.com \
    --cc=conor.dooley@microchip.com \
    --cc=daire.mcnamara@microchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®