diff options
author | Geliang Tang <geliangtang@163.com> | 2016-03-15 22:12:34 +0800 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2016-03-18 10:31:34 -0400 |
commit | 6363c6b599ae67b779d01a48642a7c0d7d721814 (patch) | |
tree | 16fbe88fc9313c9a407741151bedfe03b6b14a19 /kernel | |
parent | 7f50d06bb6b825d34f069c6c7a1aab96ad0b94d9 (diff) | |
download | linux-6363c6b599ae67b779d01a48642a7c0d7d721814.tar.bz2 |
ftrace: Use kasprintf() in ftrace_profile_tracefs()
Use kasprintf() instead of kmalloc() and snprintf().
Link: http://lkml.kernel.org/r/135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ftrace.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index d3850cbb840f..6a93faafbea4 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1030,8 +1030,7 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer) for_each_possible_cpu(cpu) { stat = &per_cpu(ftrace_profile_stats, cpu); - /* allocate enough for function name + cpu number */ - name = kmalloc(32, GFP_KERNEL); + name = kasprintf(GFP_KERNEL, "function%d", cpu); if (!name) { /* * The files created are permanent, if something happens @@ -1043,7 +1042,6 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer) return; } stat->stat = function_stats; - snprintf(name, 32, "function%d", cpu); stat->stat.name = name; ret = register_stat_tracer(&stat->stat); if (ret) { |