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>
This commit is contained in:
Tudor Ambarus 2017-04-25 16:26:36 +03:00 committed by Herbert Xu
parent 15a9b363de
commit 7fcaf62a9f

View file

@ -374,6 +374,8 @@ static inline u8 *caam_read_raw_data(const u8 *buf, size_t *nbytes)
buf++; buf++;
(*nbytes)--; (*nbytes)--;
} }
if (!*nbytes)
return NULL;
val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL); val = kzalloc(*nbytes, GFP_DMA | GFP_KERNEL);
if (!val) if (!val)