Commit e59464c735db19619cde2aa331609adb02005f5b
Committed by
Linus Torvalds
1 parent
46da276648
Exists in
master
and in
39 other branches
flex_array: fix the panic when calling flex_array_alloc() without __GFP_ZERO
memset() is called with the wrong address and the kernel panics. Signed-off-by: Changli Gao <xiaosuo@gmail.com> Cc: Patrick McHardy <kaber@trash.net> Acked-by: David Rientjes <rientjes@google.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff
lib/flex_array.c
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | ret->element_size = element_size; |
100 | 100 | ret->total_nr_elements = total; |
101 | 101 | if (elements_fit_in_base(ret) && !(flags & __GFP_ZERO)) |
102 | - memset(ret->parts[0], FLEX_ARRAY_FREE, | |
102 | + memset(&ret->parts[0], FLEX_ARRAY_FREE, | |
103 | 103 | FLEX_ARRAY_BASE_BYTES_LEFT); |
104 | 104 | return ret; |
105 | 105 | } |