diff options
author | Tudor Ambarus <tudor-dan.ambarus@nxp.com> | 2017-04-25 15:26:36 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-05-18 07:19:50 +0200 |
commit | 7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc (patch) | |
tree | c58d53682335afd6cabaa2fa62979d81c545d2e7 /drivers/crypto/caam | |
parent | crypto: sha512-mb - add some missing unlock on error (diff) | |
download | linux-7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc.tar.xz linux-7fcaf62a9f6348bcdc8d2816f93f64cf7f3f87fc.zip |
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/crypto/caam')
-rw-r--r-- | drivers/crypto/caam/caampkc.c | 2 |
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) |