[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240304-dislike-enchanted-bab883cdd609@wendy>
Date: Mon, 4 Mar 2024 09:52:52 +0000
From: Conor Dooley <conor.dooley@...rochip.com>
To: Dawei Li <dawei.li@...ngroup.cn>
CC: <daire.mcnamara@...rochip.com>, <linux-riscv@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] firmware: microchip: Fix over-requested allocation size
Hey,
On Mon, Mar 04, 2024 at 05:25:32PM +0800, Dawei Li wrote:
> cocci warnings: (new ones prefixed by >>)
> >> drivers/firmware/microchip/mpfs-auto-update.c:387:72-78:
> ERROR: application of sizeof to pointer
> drivers/firmware/microchip/mpfs-auto-update.c:170:72-78:
> ERROR: application of sizeof to pointer
>
> response_msg is a pointer to u32, so the size of element it points to is
> supposed to be a multiple of sizeof(u32), rather than sizeof(u32 *).
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202403040516.CYxoWTXw-lkp@intel.com/
> Signed-off-by: Dawei Li <dawei.li@...ngroup.cn>
> ---
> drivers/firmware/microchip/mpfs-auto-update.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/microchip/mpfs-auto-update.c b/drivers/firmware/microchip/mpfs-auto-update.c
> index 682e417be5a3..7ea3cdb917bc 100644
> --- a/drivers/firmware/microchip/mpfs-auto-update.c
> +++ b/drivers/firmware/microchip/mpfs-auto-update.c
> @@ -384,7 +384,7 @@ static int mpfs_auto_update_available(struct mpfs_auto_update_priv *priv)
> u32 *response_msg;
> int ret;
>
> - response_msg = devm_kzalloc(priv->dev, AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(response_msg),
> + response_msg = devm_kzalloc(priv->dev, AUTO_UPDATE_FEATURE_RESP_SIZE * sizeof(u32),
Why not use `sizeof(*response_msg)`?
Cheers,
Conor.
> GFP_KERNEL);
> if (!response_msg)
> return -ENOMEM;
> --
> 2.27.0
>
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists