
2 Oct
2019
2 Oct
'19
2:37 p.m.
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 --- lib/linux_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/linux_compat.c b/lib/linux_compat.c index 6373b4451e..81ea8fb126 100644 --- 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;
--
2.17.1