Skip to content

Commit

Permalink
crypto: caam - avoid kzalloc(0) in caam_read_raw_data
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tudor Ambarus authored and Herbert Xu committed May 18, 2017
1 parent 15a9b36 commit 7fcaf62
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/crypto/caam/caampkc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7fcaf62

Please sign in to comment.