[U-Boot] [PATCH 04/21] sandbox: net: Correct name copy in eth_raw_bus_post_bind()

Simon Glass sjg at chromium.org
Sat Nov 24 04:29:27 UTC 2018


We cannot be sure that the interface name takes up the full length of the
space available to it. Use strcpy() instead of memcpy() in this case. This
corrects a valgrind warning.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 drivers/net/sandbox-raw-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/sandbox-raw-bus.c b/drivers/net/sandbox-raw-bus.c
index 76d65afe6c8..0086f25fc1f 100644
--- a/drivers/net/sandbox-raw-bus.c
+++ b/drivers/net/sandbox-raw-bus.c
@@ -42,7 +42,7 @@ static int eth_raw_bus_post_bind(struct udevice *dev)
 		device_probe(child);
 		priv = dev_get_priv(child);
 		if (priv) {
-			memcpy(priv->host_ifname, i->if_name, IFNAMSIZ);
+			strcpy(priv->host_ifname, i->if_name);
 			priv->host_ifindex = i->if_index;
 			priv->local = local;
 		}
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



More information about the U-Boot mailing list