From: Tudor Ambarus <[email protected]> The function returns NULL if buf is composed only of zeros.
Signed-off-by: Tudor Ambarus <[email protected]> Signed-off-by: Horia Geantă <[email protected]> --- drivers/crypto/caam/caampkc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/caam/caampkc.c b/drivers/crypto/caam/caampkc.c index 49cbdcba7883..999ba18495b0 100644 --- a/drivers/crypto/caam/caampkc.c +++ b/drivers/crypto/caam/caampkc.c @@ -374,6 +374,8 @@ static inline u8 *caam_read_raw_data(const u8 *buf, size_t *nbytes) buf++; (*nbytes)--; } + if (!*nbytes) + return NULL; val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL); if (!val) -- 2.12.0.264.gd6db3f216544
