From: Jiri Slaby <jirislaby@gmail.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Li Zefan <lizf@cn.fujitsu.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: use strlcpy instead of strncpy
Date: Mon, 18 May 2009 22:55:56 +0200 [thread overview]
Message-ID: <4A11CB5C.8070800@gmail.com> (raw)
In-Reply-To: <4A11480F.3030000@cn.fujitsu.com>
On 05/18/2009 01:35 PM, Lai Jiangshan wrote:
> strlcpy() will add '\0' for the copied string.
>
> [Impact] cleanup
...
> --- a/kernel/trace/trace_branch.c
> +++ b/kernel/trace/trace_branch.c
> @@ -67,10 +67,8 @@ probe_likely_condition(struct ftrace_branch_data *f, int val, int expect)
> p--;
> p++;
>
> - strncpy(entry->func, f->func, TRACE_FUNC_SIZE);
> - strncpy(entry->file, p, TRACE_FILE_SIZE);
> - entry->func[TRACE_FUNC_SIZE] = 0;
> - entry->file[TRACE_FILE_SIZE] = 0;
> + strlcpy(entry->func, f->func, TRACE_FUNC_SIZE);
> + strlcpy(entry->file, p, TRACE_FILE_SIZE);
Hmm, this is not the same. +1 is missing here.
next prev parent reply other threads:[~2009-05-18 20:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-18 11:35 [PATCH] tracing: use strlcpy instead of strncpy Lai Jiangshan
2009-05-18 20:55 ` Jiri Slaby [this message]
2009-05-19 1:51 ` Lai Jiangshan
2009-05-19 12:54 ` Stefan Richter
2009-05-20 2:34 ` Lai Jiangshan
2009-05-19 23:43 ` 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=4A11CB5C.8070800@gmail.com \
--to=jirislaby@gmail.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--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