mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] kernel/trace/ftrace.c: replace kmalloc/snprintf by kasprintf
@ 2014-06-09 11:47 Fabian Frederick
  2014-06-09 13:49 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-06-09 11:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: Fabian Frederick, Steven Rostedt, Andrew Morton

Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] kernel/trace/ftrace.c: replace kmalloc/snprintf by kasprintf
  2014-06-09 11:47 [PATCH 1/1] kernel/trace/ftrace.c: replace kmalloc/snprintf by kasprintf Fabian Frederick
@ 2014-06-09 13:49 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2014-06-09 13:49 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: linux-kernel, Andrew Morton

On Mon,  9 Jun 2014 13:47:21 +0200
Fabian Frederick <fabf@skynet.be> wrote:

> @@ -1097,7 +1094,6 @@ static __init void ftrace_profile_debugfs(struct dentry *d_tracer)
>  			return;
>  		}
>  	}
> -

Unneeded change.

-- Steve

>  	entry = debugfs_create_file("function_profile_enabled", 0644,
>  				    d_tracer, NULL, &ftrace_profile_fops);
>  	if (!entry)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-09 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-09 11:47 [PATCH 1/1] kernel/trace/ftrace.c: replace kmalloc/snprintf by kasprintf Fabian Frederick
2014-06-09 13:49 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®