summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2018-05-14 13:00:32 +0800
committerFerruh Yigit <ferruh.yigit@intel.com>2018-05-14 23:32:23 +0200
commit1bcb5ecb179cbca81ff3fe15432326c1c3ca9e9b (patch)
treee94ddfa7fafd3ce41bb5360b5ad23db18ad16a8d
parent62280b7819d24643e70a1428191288133d3d7235 (diff)
downloaddpdk-1bcb5ecb179cbca81ff3fe15432326c1c3ca9e9b.zip
dpdk-1bcb5ecb179cbca81ff3fe15432326c1c3ca9e9b.tar.gz
dpdk-1bcb5ecb179cbca81ff3fe15432326c1c3ca9e9b.tar.xz
net/nfp: fix memcpy out of source range
drivers/net/nfp/nfp_net.c:669:2: error: ‘memcpy’ forming offset [5, 6] is out of the bounds [0, 4] of object ‘tmp’ with type ‘uint32_t’ {aka ‘unsigned int’} [-Werror=array-bounds] memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr)); Fixes: e6decee38209 ("net/nfp: use random MAC address if not configured") Cc: stable@dpdk.org Signed-off-by: Andy Green <andy@warmcat.com> Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com> Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
-rw-r--r--drivers/net/nfp/nfp_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 8a712d6..80dc273 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -527,7 +527,7 @@ nfp_net_vf_read_mac(struct nfp_net_hw *hw)
uint32_t tmp;
tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR));
- memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr));
+ memcpy(&hw->mac_addr[0], &tmp, 4);
tmp = rte_be_to_cpu_32(nn_cfg_readl(hw, NFP_NET_CFG_MACADDR + 4));
memcpy(&hw->mac_addr[4], &tmp, 2);