Commit 6363c6b5 authored by Geliang Tang's avatar Geliang Tang Committed by Steven Rostedt

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.comAcked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarGeliang Tang <geliangtang@163.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 7f50d06b
...@@ -1030,8 +1030,7 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer) ...@@ -1030,8 +1030,7 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
stat = &per_cpu(ftrace_profile_stats, cpu); stat = &per_cpu(ftrace_profile_stats, cpu);
/* allocate enough for function name + cpu number */ name = kasprintf(GFP_KERNEL, "function%d", cpu);
name = kmalloc(32, GFP_KERNEL);
if (!name) { if (!name) {
/* /*
* The files created are permanent, if something happens * The files created are permanent, if something happens
...@@ -1043,7 +1042,6 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer) ...@@ -1043,7 +1042,6 @@ static __init void ftrace_profile_tracefs(struct dentry *d_tracer)
return; return;
} }
stat->stat = function_stats; stat->stat = function_stats;
snprintf(name, 32, "function%d", cpu);
stat->stat.name = name; stat->stat.name = name;
ret = register_stat_tracer(&stat->stat); ret = register_stat_tracer(&stat->stat);
if (ret) { if (ret) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment