From patchwork Fri Jul 17 14:27:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 29922 Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id D6546B7083 for ; Sat, 18 Jul 2009 00:34:29 +1000 (EST) Received: by ozlabs.org (Postfix) id C9FD1DDD0C; Sat, 18 Jul 2009 00:34:29 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (bilbo.ozlabs.org [203.10.76.25]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bilbo.ozlabs.org", Issuer "CAcert Class 3 Root" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id C796ADDD01 for ; Sat, 18 Jul 2009 00:34:29 +1000 (EST) Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 8A8E1B7DED for ; Sat, 18 Jul 2009 00:33:59 +1000 (EST) Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 72CB2B70A6 for ; Sat, 18 Jul 2009 00:33:52 +1000 (EST) Received: by ozlabs.org (Postfix) id 5A461DDD1B; Sat, 18 Jul 2009 00:33:52 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org X-Greylist: delayed 465 seconds by postgrey-1.31 at ozlabs; Sat, 18 Jul 2009 00:33:50 EST Received: from mail-ew0-f225.google.com (mail-ew0-f225.google.com [209.85.219.225]) by ozlabs.org (Postfix) with ESMTP id E6013DDD01; Sat, 18 Jul 2009 00:33:49 +1000 (EST) Received: by ewy25 with SMTP id 25so888529ewy.9 for ; Fri, 17 Jul 2009 07:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=jXZAjYop+5TAIshUaotqSokyGFEMMaucnfjMRBPomL4=; b=KnQ1ZXbg0jCk7JknMFLAa+mtQTgbmNUb/8Zr/QCK7OV2SVaAf3lVkw8mO6CpOKMGTA MN9wxW2UdGo1/0bnRWrmu6DqgB+CmR10w5MBFs7+xW96tTwMM57aqkt1517PTipi1EJZ bLH71f22CJC58X0fz1ytid4SeITy3FSegzRJE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=ecrVZ15IdwKfq6ovL8rAmtnRn+DPa80b7PRfvxtn1l7SERFleek+UnIPXUZaALMKJq MdDjFLjlKccL3djL/KxEI5ch08DepwM87gjKVm8+7H9iBOyYXN7W5dRg25ESuLYcZSw/ shfe9jSIYBBzjEfHtqCHKbN8rmhbiygTjJQ7o= Received: by 10.210.42.20 with SMTP id p20mr882476ebp.60.1247840761012; Fri, 17 Jul 2009 07:26:01 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 23sm927330eya.0.2009.07.17.07.25.59 (version=SSLv3 cipher=RC4-MD5); Fri, 17 Jul 2009 07:26:00 -0700 (PDT) Message-ID: <4A608A69.4060204@gmail.com> Date: Fri, 17 Jul 2009 16:27:53 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Thunderbird/3.0b2 MIME-Version: 1.0 To: arnd@arndb.de Subject: Re: [PATCH] powerpc/cell: strncpy does not null terminate string References: <4A607185.6020302@gmail.com> In-Reply-To: <4A607185.6020302@gmail.com> Cc: linuxppc-dev@ozlabs.org, Andrew Morton , cbe-oss-dev@ozlabs.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org strlcpy() will always null terminate the string. Signed-off-by: Roel Kluin --- Please use this one instead diff --git a/arch/powerpc/platforms/cell/celleb_setup.c b/arch/powerpc/platforms/cell/celleb_setup.c index 07c234f..1896cd8 100644 --- a/arch/powerpc/platforms/cell/celleb_setup.c +++ b/arch/powerpc/platforms/cell/celleb_setup.c @@ -80,7 +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)); + strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type)); celleb_machine_type[sizeof(celleb_machine_type)-1] = 0; return 0; }