From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTP id E264EDE13E for ; Fri, 10 Aug 2007 05:46:00 +1000 (EST) In-Reply-To: References: <00a85f152aa3547f0f0b4acd7954468a@kernel.crashing.org> <2055bb54b9816faaf5b2ceedc9cfa039@kernel.crashing.org> <87DC7695-382B-4641-B9D9-75ACB49D41A4@kernel.crashing.org> <719AE7E4-FE6D-4973-8887-F787EC8ABC85@kernel.crashing.org> <235e0ff22961e25016727c0e74fd0c0f@kernel.crashing.org> <19a13f8700d078abc4cab0064a7d0183@kernel.crashing.org> <46B0F030.9030007@freescale.com> Mime-Version: 1.0 (Apple Message framework v623) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <3368b27f860fafb35d10f6352e9055bf@kernel.crashing.org> From: Segher Boessenkool Subject: Re: [PATCH] powerpc: fix i2c device string format Date: Thu, 9 Aug 2007 21:45:46 +0200 To: Guennadi Liakhovetski Cc: linuxppc-dev@ozlabs.org, Paul Mackerras List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , >> strncpy() won't put a terminating zero on there, is everything >> that uses the resulting string okay with that? Also, if the >> name gets cut short, it might match some _other_ expected name. > > On Wed, 1 Aug 2007, Scott Wood wrote: > >> You could use strlcpy() instead, which always leaves a zero >> terminator. > > The patch below does exactly this - uses strlcpy() to guarantee > strings in > i2c device type and driver_name fields are 0-terminated. You're not checking the return values of these calls. This would be a good function to put attribute warn_unused_result on :-) Segher