mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
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:
parent
15a9b363de
commit
7fcaf62a9f
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue