diff mbox series

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

Message ID 20181124042944.239106-5-sjg@chromium.org
State Accepted
Commit e628bba785a310e80193f9a34c0b53fcb2136c46
Delegated to: Simon Glass
Headers show
Series Various patches for verified boot support | expand

Commit Message

Simon Glass Nov. 24, 2018, 4:29 a.m. UTC
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@chromium.org>
---

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

Comments

Simon Glass Dec. 5, 2018, 11:10 p.m. UTC | #1
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@chromium.org>
---

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

Applied to u-boot-dm/master, thanks!
diff mbox series

Patch

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;
 		}