From: Herbert Xu <herbert@gondor.apana.org.au>
To: Gongwei Li <13875017792@163.com>
Cc: horia.geanta@nxp.com, pankaj.gupta@nxp.com, gaurav.jain@nxp.com,
davem@davemloft.net, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org, Gongwei Li <ligongwei@kylinos.cn>
Subject: Re: [PATCH 1/1] crypto: caam - use kmalloc_array() instead of kmalloc()
Date: Fri, 19 Dec 2025 11:31:06 +0800 [thread overview]
Message-ID: <aUTG-tlRzFWdkLE2@gondor.apana.org.au> (raw)
In-Reply-To: <20251121024456.47381-1-13875017792@163.com>
On Fri, Nov 21, 2025 at 10:44:56AM +0800, Gongwei Li wrote:
> From: Gongwei Li <ligongwei@kylinos.cn>
>
> Replace kmalloc() with kmalloc_array() to prevent potential
> overflow, as recommended in Documentation/process/deprecated.rst.
>
> Signed-off-by: Gongwei Li <ligongwei@kylinos.cn>
> ---
> drivers/crypto/caam/ctrl.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index 320be5d77737..81583251b1f6 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -208,7 +208,7 @@ static int deinstantiate_rng(struct device *ctrldev, int state_handle_mask)
> u32 *desc, status;
> int sh_idx, ret = 0;
>
> - desc = kmalloc(CAAM_CMD_SZ * 3, GFP_KERNEL);
> + desc = kmalloc_array(3, CAAM_CMD_SZ, GFP_KERNEL);
This is pointless because CAAM_CMD_SZ is a constant.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
prev parent reply other threads:[~2025-12-19 3:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 2:44 Gongwei Li
2025-12-19 3:31 ` Herbert Xu [this message]
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=aUTG-tlRzFWdkLE2@gondor.apana.org.au \
--to=herbert@gondor.apana.org.au \
--cc=13875017792@163.com \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=horia.geanta@nxp.com \
--cc=ligongwei@kylinos.cn \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.com \
/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®