public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [GIT PULL] tracing: Fix misuse of strncpy to copy boot params
Date: Thu, 15 Oct 2009 10:01:13 +0800	[thread overview]
Message-ID: <4AD68269.50701@cn.fujitsu.com> (raw)
In-Reply-To: <1255552732-5096-1-git-send-email-fweisbec@gmail.com>

> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 4506826..621d81e 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -131,7 +131,7 @@ static char *default_bootup_tracer;
>  
>  static int __init set_ftrace(char *str)
>  {
> -	strncpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);
> +	strlcpy(bootup_tracer_buf, str, MAX_TRACER_SIZE);

Actually using strncpy() here is fine.

See how the str buf is used:

int register_tracer(struct tracer *type)
{
	...
	if (strncmp(default_bootup_tracer, type->name, MAX_TRACER_SIZE))
	...
}

>  	default_bootup_tracer = bootup_tracer_buf;
>  	/* We are using ftrace early, expand it */
>  	ring_buffer_expanded = 1;

  reply	other threads:[~2009-10-15  2:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14 20:38 [GIT PULL] tracing: Fix misuse of strncpy to copy boot params Frederic Weisbecker
2009-10-15  2:01 ` Li Zefan [this message]
2009-10-15 12:32   ` Frederic Weisbecker

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=4AD68269.50701@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    /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