linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: Ken Kawakami <ken.kawakami@toshiba.co.jp>
Cc: linuxppc-dev@ozlabs.org,
	Andrew Morton <akpm@linux-foundation.org>,
	cbe-oss-dev@ozlabs.org, arnd@arndb.de
Subject: [PATCH] powerpc/cell: replace strncpy by strlcpy
Date: Tue, 21 Jul 2009 12:17:17 +0200	[thread overview]
Message-ID: <4A6595AD.9000209@gmail.com> (raw)
In-Reply-To: <4A607185.6020302@gmail.com>

Replace strncpy() and explicit null-termination by strlcpy()

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Arnd-san, Ken-san,

Thanks for reviewing,

> We prefer to take the patch which is replacing the two lines with one.

Doozo.

diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c
index 07c234f..e538455 100644
--- a/arch/powerpc/platforms/cell/celleb_setup.c
+++ b/arch/powerpc/platforms/cell/celleb_setup.c
@@ -80,8 +80,7 @@ static void celleb_show_cpuinfo(struct seq_file *m)
 
 static int __init celleb_machine_type_hack(char *ptr)
 {
-	strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
-	celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;
+	strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
 	return 0;
 }
 

  parent reply	other threads:[~2009-07-21 10:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-17 12:41 [PATCH] powerpc/cell: strncpy does not null terminate string Roel Kluin
2009-07-17 14:27 ` Roel Kluin
2009-07-17 15:56   ` Arnd Bergmann
2009-07-21  9:31     ` Ken Kawakami
2009-07-17 15:05 ` Arnd Bergmann
2009-07-17 15:19   ` roel kluin
2009-07-21 10:17 ` Roel Kluin [this message]
2009-07-22  4:22   ` [PATCH] powerpc/cell: replace strncpy by strlcpy Ken Kawakami

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=4A6595AD.9000209@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=cbe-oss-dev@ozlabs.org \
    --cc=ken.kawakami@toshiba.co.jp \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).