[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2025091847-glowing-ripping-df0a@gregkh>
Date: Thu, 18 Sep 2025 12:48:35 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Guangshuo Li <lgs201920130244@...il.com>
Cc: Horia Geantă <horia.geanta@....com>,
Pankaj Gupta <pankaj.gupta@....com>,
Gaurav Jain <gaurav.jain@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Dan Douglass <dan.douglass@....com>,
Meenakshi Aggarwal <meenakshi.aggarwal@....com>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH] crypto: caam: Add check for kcalloc() in test_len()
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@...r.kernel.org
No need for stable here.
> Signed-off-by: Guangshuo Li <lgs201920130244@...il.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
Powered by blists - more mailing lists