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

Laurence Withers lwithers at guralp.com
Thu Jul 14 14:31:07 CEST 2011


In miiphy_register() the new device's name was initialised by passing a
string parameter as the format string to sprintf(). As this would cause
problems if it ever contained a '%' symbol, switch to using strcpy()
instead.

Signed-off-by: Laurence Withers <lwithers at guralp.com>
Cc: Andy Fleming <afleming at freescale.com>
---
 common/miiphyutil.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index bcab74e..0ddf88e 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -141,7 +141,7 @@ void miiphy_register(const char *name,
 	/* initalize mii_dev struct fields */
 	new_dev->read = legacy_miiphy_read;
 	new_dev->write = legacy_miiphy_write;
-	sprintf(new_dev->name, name);
+	strcpy(new_dev->name, name);
 	ldev->read = read;
 	ldev->write = write;
 	new_dev->priv = ldev;
-- 
1.7.2.5



More information about the U-Boot mailing list