From 28aa16db4ae64c48f4341fc9b6d05922d7e62c84 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Fri, 6 Apr 2018 17:00:31 +0530 Subject: [PATCH] net/tap: fix memcpy with incorrect size Fix incorrect sizeof operation being used for getting mac addr size. Found while compiling with arm64 clang. drivers/net/tap/rte_eth_tap.c:1410:40: error: argument to 'sizeof' in 'memcpy' call is the same pointer type 'struct ether_addr *' as the destination; expected 'struct ether_addr' or an explicit length [-Werror,-Wsizeof-pointer-memaccess] rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr)); ~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~ Fixes: bcab6c1d27fa ("net/tap: allow user MAC to be passed as args") Signed-off-by: Pavan Nikhilesh Acked-by: Zhiyong Yang --- drivers/net/tap/rte_eth_tap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index ed6d7380e2..0a1b4ccb4f 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -1407,7 +1407,7 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, char *tap_name, if (is_zero_ether_addr(mac_addr)) eth_random_addr((uint8_t *)&pmd->eth_addr); else - rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(mac_addr)); + rte_memcpy(&pmd->eth_addr, mac_addr, sizeof(*mac_addr)); /* Immediately create the netdevice (this will create the 1st queue). */ /* rx queue */ -- 2.20.1