projects
/
oweals
/
u-boot.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9b3fbb2
)
linux_compat: fix potential NULL pointer access
author
Marek Szyprowski
<m.szyprowski@samsung.com>
Wed, 2 Oct 2019 12:37:20 +0000
(14:37 +0200)
committer
Tom Rini
<trini@konsulko.com>
Thu, 31 Oct 2019 11:22:53 +0000
(07:22 -0400)
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>
lib/linux_compat.c
patch
|
blob
|
history
diff --git
a/lib/linux_compat.c
b/lib/linux_compat.c
index 6373b4451eb3fdafaed99cfeb7eb40f7821712b0..81ea8fb126fa2fec7230479ae77d744cde337e4c 100644
(file)
--- a/
lib/linux_compat.c
+++ b/
lib/linux_compat.c
@@
-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;