From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: zhang.enpei@zte.com.cn, horia.geanta@nxp.com
Cc: pankaj.gupta@nxp.com, gaurav.jain@nxp.com,
herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: caam - switch to use devm_kmemdup_array()
Date: Sat, 19 Jul 2025 15:00:27 +0200 [thread overview]
Message-ID: <e4c297a7-1ef1-4c39-8daa-8acdade47508@wanadoo.fr> (raw)
In-Reply-To: <20250719163416760SUAwKHXRQRBFKhvAOpNbT@zte.com.cn>
Le 19/07/2025 à 10:34, zhang.enpei@zte.com.cn a écrit :
> From: Zhang Enpei <zhang.enpei@zte.com.cn>
> Use devm_kmemdup_array() to avoid multiplication or possible overflows.
>
> Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
> ---
> drivers/crypto/caam/ctrl.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
> index ce7b99019537..2250dce9c344 100644
> --- a/drivers/crypto/caam/ctrl.c
> +++ b/drivers/crypto/caam/ctrl.c
> @@ -592,9 +592,9 @@ static int init_clocks(struct device *dev, const struct caam_imx_data *data)
> int ret;
>
> ctrlpriv->num_clks = data->num_clks;
> - ctrlpriv->clks = devm_kmemdup(dev, data->clks,
> - data->num_clks * sizeof(data->clks[0]),
> - GFP_KERNEL);
> + ctrlpriv->clks = devm_kmemdup_array(dev, data->clks,
> + data->num_clks, sizeof(data->clks[0]),
sizeof(*data->clks) maybe?
> + GFP_KERNEL);
> if (!ctrlpriv->clks)
> return -ENOMEM;
>
Just my 2c,
CJ
next prev parent reply other threads:[~2025-07-19 13:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-19 8:34 zhang.enpei
2025-07-19 13:00 ` Christophe JAILLET [this message]
2025-07-21 2:06 ` zhang.enpei
2025-07-22 17:03 ` Christophe JAILLET
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=e4c297a7-1ef1-4c39-8daa-8acdade47508@wanadoo.fr \
--to=christophe.jaillet@wanadoo.fr \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pankaj.gupta@nxp.com \
--cc=zhang.enpei@zte.com.cn \
/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®