From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laurence Withers Date: Fri, 15 Jul 2011 09:21:24 +0000 Subject: [U-Boot] [PATCH] miiphy: use strcpy() not sprintf() In-Reply-To: <201107141402.43091.vapier@gentoo.org> References: <1310646667-2426-1-git-send-email-lwithers@guralp.com> <4E1EF3E3.8090600@aribaud.net> <201107141402.43091.vapier@gentoo.org> Message-ID: <20110715092123.GC5891@guralp.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, Jul 14, 2011 at 02:02:42PM -0400, Mike Frysinger wrote: > On Thursday, July 14, 2011 09:49:23 Albert ARIBAUD wrote: > > Please use strncpy() which will also guard against overflows. > > or BUG_ON(strlen(name) >= MDIO_NAME_LEN) > -mike Patch v3 has both. The original code did have a check for the name overflowing but BUG_ON() is IMO clearer so I switched to using it instead. I kept strncpy() in v3, rather than just strcpy(), because it makes the code robust against future edits. Thanks for the feedback. Bye for now, -- Laurence Withers, http://www.guralp.com/ Direct tel:+447753988197 or tel:+443333408643 Software Engineer General support queries: CMG-DCM CMG-EAM CMG-NAM