mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +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;
|
||||
|
||||
p = malloc_cache_aligned(size);
|
||||
if (flags & __GFP_ZERO)
|
||||
if (p && flags & __GFP_ZERO)
|
||||
memset(p, 0, size);
|
||||
|
||||
return p;
|
||||
|
|
Loading…
Reference in a new issue