[PATCH 1/1] kernel/trace/ftrace.c: replace kmalloc/snprintf by kasprintf

From: Fabian Frederick
Date: Mon Jun 09 2014 - 07:48:45 EST


Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Fabian Frederick <fabf@xxxxxxxxx>
---
kernel/trace/ftrace.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 4a54a25..92a3316 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -1072,9 +1072,7 @@ static __init void ftrace_profile_debugfs(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
@@ -1086,7 +1084,6 @@ static __init void ftrace_profile_debugfs(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) {
@@ -1097,7 +1094,6 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
return;
}
}
-
entry = debugfs_create_file("function_profile_enabled", 0644,
d_tracer, NULL, &ftrace_profile_fops);
if (!entry)
--
1.8.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/