flex_array: fix the panic issue when calling flex_array_alloc() without __GFP_ZERO
Subsystems (2)
PATCH 1/3 flex_array: fix the panic issue when calling flex_array_alloc() without __GFP_ZERO
fix the panic issue when calling flex_array_alloc() without __GFP_ZERO.
memset is called with the wrong address, then kernel panics.
Signed-off-by Changli Gao <[email protected]>
----lib/flex_array.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
lib/flex_array.c +1 -1
@@ -99,7 +99,7 @@ struct flex_array *flex_array_alloc(int element_size, unsigned int total, ret->element_size = element_size; ret->total_nr_elements = total;if (elements_fit_in_base (ret) && !(flags & __GFP_ZERO)) -memset (ret->parts[0 ],FLEX_ARRAY_FREE , +memset (&ret->parts[0 ],FLEX_ARRAY_FREE ,FLEX_ARRAY_BASE_BYTES_LEFT );return ret; }
Quoted 5 lines · Changli Gao
fix the panic issue when calling
flex_array_alloc()without__GFP_ZERO.memset is called with the wrong address, then kernel panics.
Signed-off-by Changli Gao <[email protected]>
Acked-by David Rientjes <[email protected]>