Skip to content

Commit

Permalink
flex_array: fix the panic when calling flex_array_alloc() without __G…
Browse files Browse the repository at this point in the history
…FP_ZERO

memset() is called with the wrong address and the kernel panics.

Signed-off-by: Changli Gao <[email protected]>
Cc: Patrick McHardy <[email protected]>
Acked-by: David Rientjes <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
xiaosuo authored and torvalds committed Apr 24, 2010
1 parent 46da276 commit e59464c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/flex_array.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit e59464c

Please sign in to comment.