* [PATCH] firmware: microchip: use kzalloc_objs() instead of kzalloc() with multiply
@ 2026-09-01 7:29 Hrushiraj Gandhi
0 siblings, 0 replies; only message in thread
From: Hrushiraj Gandhi @ 2026-09-01 7:29 UTC (permalink / raw)
To: conor.dooley, daire.mcnamara; +Cc: linux-riscv, linux-kernel, Hrushiraj Gandhi
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) =
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-01 7:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 7:29 [PATCH] firmware: microchip: use kzalloc_objs() instead of kzalloc() with multiply Hrushiraj Gandhi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox