From: Tudor Ambarus Date: Tue, 25 Apr 2017 13:26:36 +0000 (+0300) Subject: crypto: caam - avoid kzalloc(0) in caam_read_raw_data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git crypto: caam - avoid kzalloc(0) in caam_read_raw_data The function returns NULL if buf is composed only of zeros. Signed-off-by: Tudor Ambarus Signed-off-by: Horia Geantă Signed-off-by: Herbert Xu --- 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)