[U-Boot] [PATCH] miiphy: use strcpy() not sprintf()

Laurence Withers lwithers at guralp.com
Fri Jul 15 11:21:24 CEST 2011


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, <lwithers at guralp.com>                http://www.guralp.com/
Direct tel:+447753988197 or tel:+443333408643               Software Engineer
General support queries: <support at guralp.com>         CMG-DCM CMG-EAM CMG-NAM


More information about the U-Boot mailing list