public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Mike Frysinger <vapier@gentoo.org>,
	Paul Mundt <lethal@linux-sh.org>,
	realmz paranoid <realmz6@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	monstr@monstr.eu,
	"uclinux-dist-devel@blackfin.uclinux.org" 
	<uclinux-dist-devel@blackfin.uclinux.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux-Arch <linux-arch@vger.kernel.org>
Subject: Re: [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy
Date: Mon, 27 May 2013 09:50:56 +0800	[thread overview]
Message-ID: <51A2BC00.2050906@asianux.com> (raw)
In-Reply-To: <51A1B419.5000704@asianux.com>

On 05/26/2013 03:04 PM, Chen Gang wrote:
> 
> For NULL terminated string, need always be sure of ended by zero.
> 
> 'command_line' is a static variable which will be initialized
> automatically, and cmdline_init() is __init function, so need not
> initialize it again, can just use strlcpy instead of strncpy.
> 

The 2nd paragraph comment is redundent, need delete. I will send patch v2.

> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/blackfin/kernel/setup.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
> index 107b306..c731ec7 100644
> --- a/arch/blackfin/kernel/setup.c
> +++ b/arch/blackfin/kernel/setup.c
> @@ -1458,5 +1458,5 @@ void __init cmdline_init(const char *r0)
>  {
>  	early_shadow_stamp();
>  	if (r0)
> -		strncpy(command_line, r0, COMMAND_LINE_SIZE);
> +		strlcpy(command_line, r0, COMMAND_LINE_SIZE);
>  }
> 


-- 
Chen Gang

Asianux Corporation

  reply	other threads:[~2013-05-27  1:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26  7:04 [PATCH] arch: blackfin: kernel: using strlcpy instead of strncpy Chen Gang
2013-05-27  1:50 ` Chen Gang [this message]
2013-05-27  1:51 ` [PATCH v2] arch: blackfin: kernel: using strlcpy() instead of strncpy() Chen Gang

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=51A2BC00.2050906@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=geert@linux-m68k.org \
    --cc=lethal@linux-sh.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monstr@monstr.eu \
    --cc=realmz6@gmail.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    --cc=vapier@gentoo.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