diff options
author | Thomas Meyer <thomas@m3y3r.de> | 2011-11-29 22:08:00 +0100 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2012-02-13 13:48:11 -0500 |
commit | 47b0edcb599ea6eb9ef16d3a08932a0e01485293 (patch) | |
tree | c72965c718a4e50a845c1e0ec898fc2d86825104 /kernel/trace/ftrace.c | |
parent | 95100358491abaa2e9a5483811370059bbca4645 (diff) |
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>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index e2e0597c0845..d1499e910fe8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -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); |