summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTudor Ambarus <tudor-dan.ambarus@nxp.com>2017-04-25 16:26:36 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-05-18 13:19:50 +0800
commit7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc (patch)
treec58d53682335afd6cabaa2fa62979d81c545d2e7 /drivers
parent15a9b363de232236a31922d5a928d1830bc42060 (diff)
downloadlinux-7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc.tar.bz2
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 <tudor-dan.ambarus@nxp.com> Signed-off-by: Horia Geantă <horia.geanta@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/caam/caampkc.c2
1 files changed, 2 insertions, 0 deletions
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)