From: Greg KH <gregkh@linuxfoundation.org>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: "Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Gaurav Jain" <gaurav.jain@nxp.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
"Dan Douglass" <dan.douglass@nxp.com>,
"Meenakshi Aggarwal" <meenakshi.aggarwal@nxp.com>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] crypto: caam: Add check for kcalloc() in test_len()
Date: Thu, 18 Sep 2025 12:48:35 +0200 [thread overview]
Message-ID: <2025091847-glowing-ripping-df0a@gregkh> (raw)
In-Reply-To: <20250918101527.3458436-1-lgs201920130244@gmail.com>
On Thu, Sep 18, 2025 at 06:15:27PM +0800, Guangshuo Li wrote:
> As kcalloc() may fail, check its return value to avoid a NULL pointer
> dereference when passing the buffer to rng->read() and
> print_hex_dump_debug().
But that is not what this patch does :(
> Fixes: 2be0d806e25e ("crypto: caam - add a test for the RNG")
> Cc: stable@vger.kernel.org
No need for stable here.
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
> drivers/crypto/caam/caamrng.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/crypto/caam/caamrng.c b/drivers/crypto/caam/caamrng.c
> index e0adb326f496..d887ecf6f99d 100644
> --- a/drivers/crypto/caam/caamrng.c
> +++ b/drivers/crypto/caam/caamrng.c
> @@ -183,7 +183,6 @@ static inline void test_len(struct hwrng *rng, size_t len, bool wait)
> buf = kcalloc(CAAM_RNG_MAX_FIFO_STORE_SIZE, sizeof(u8), GFP_KERNEL);
>
> if (!buf) {
> - dev_err(dev, "RNG buffer allocation failed\n");
> return;
> }
checkpatch should show that you can remove the { } now, right?
thanks,
greg k-h
next prev parent reply other threads:[~2025-09-18 10:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-18 10:15 [PATCH] crypto: caam: Add check for kcalloc() in test_len() Guangshuo Li
2025-09-18 10:48 ` Greg KH [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-09-18 12:55 Guangshuo Li
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=2025091847-glowing-ripping-df0a@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=dan.douglass@nxp.com \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=lgs201920130244@gmail.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meenakshi.aggarwal@nxp.com \
--cc=pankaj.gupta@nxp.com \
--cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.