mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-28 01:51:33 +00:00
linux_compat: fix potential NULL pointer access
malloc_cache_aligned() might return zero, so fix potential NULL pointer access if __GFP_ZERO flag is set. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Ralph Siemsen <ralph.siemsen@linaro.org>
This commit is contained in:
parent
9b3fbb2b43
commit
2ad98ab8f6
1 changed files with 1 additions and 1 deletions
|
@ -20,7 +20,7 @@ void *kmalloc(size_t size, int flags)
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = malloc_cache_aligned(size);
|
p = malloc_cache_aligned(size);
|
||||||
if (flags & __GFP_ZERO)
|
if (p && flags & __GFP_ZERO)
|
||||||
memset(p, 0, size);
|
memset(p, 0, size);
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
|
|
Loading…
Add table
Reference in a new issue