mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Geliang Tang <geliangtang@163.com>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftrace: use kasprintf() in ftrace_profile_tracefs()
Date: Fri, 18 Mar 2016 10:31:52 -0400	[thread overview]
Message-ID: <20160318103152.746b7bf5@gandalf.local.home> (raw)
In-Reply-To: <135a7bc36e51fd9eaa57124dd2140285b771f738.1458050835.git.geliangtang@163.com>

On Tue, 15 Mar 2016 22:12:34 +0800
Geliang Tang <geliangtang@163.com> wrote:

> Use kasprintf() instead of kmalloc() and snprintf().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>

Thanks, applied!

-- Steve

> ---
>  kernel/trace/ftrace.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 2ece9f1..69aceae 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) {

      parent reply	other threads:[~2016-03-18 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 14:12 Geliang Tang
2016-03-16 14:19 ` Namhyung Kim
2016-03-16 14:32   ` Steven Rostedt
2016-03-18 14:31 ` Steven Rostedt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160318103152.746b7bf5@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=geliangtang@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®