On Tue, Sep 23, 2025 at 08:44:18PM +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(). On allocation failure, log the error and return since test_len() returns void.
Fixes: 2be0d806e25e ("crypto: caam - add a test for the RNG") Cc: stable@vger.kernel.org Signed-off-by: Guangshuo Li lgs201920130244@gmail.com
changelog: v3:
- Fix build error: test_len() returns void; return without a value.
- No functional changes beyond the allocation failure path.
v2:
- Return on allocation failure to avoid possible NULL dereference.
drivers/crypto/caam/caamrng.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Patch applied. Thanks.