tracing/trivial: Use kcalloc instead of kzalloc to allocate array
The advantage of kcalloc is, that will prevent integer overflows which could result from the multiplication of number of elements and size and it is also a bit nicer to read. The semantic patch that makes this change is available in https://lkml.org/lkml/2011/11/25/107 Link: http://lkml.kernel.org/r/1322600880.1534.347.camel@localhost.localdomain Signed-off-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
committed by
Steven Rostedt
parent
9510035849
commit
47b0edcb59
@ -1129,7 +1129,7 @@ static struct ftrace_hash *alloc_ftrace_hash(int size_bits)
|
||||
return NULL;
|
||||
|
||||
size = 1 << size_bits;
|
||||
hash->buckets = kzalloc(sizeof(*hash->buckets) * size, GFP_KERNEL);
|
||||
hash->buckets = kcalloc(size, sizeof(*hash->buckets), GFP_KERNEL);
|
||||
|
||||
if (!hash->buckets) {
|
||||
kfree(hash);
|
||||
|
Reference in New Issue
Block a user