From: Qi Zhang Date: Wed, 17 Mar 2021 06:02:19 +0000 (+0800) Subject: net/ice/base: fix memory allocation for MAC addresses X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=78b52e3878c6496748cba2028f8cb9080435cb46;p=dpdk.git net/ice/base: fix memory allocation for MAC addresses Not enough memory be allocated for dev->data->mac_address which cause out of bound memory access when iterate all mac addresses by dev_info.max_mac_addrs. Fixes: f9cf4f864150 ("net/ice: support device initialization") Cc: stable@dpdk.org Reported-by: Ferruh Yigit Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 5a1190d50e..3e85e5f629 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -809,7 +809,7 @@ ice_init_mac_address(struct rte_eth_dev *dev) (struct rte_ether_addr *)hw->port_info[0].mac.perm_addr); dev->data->mac_addrs = - rte_zmalloc(NULL, sizeof(struct rte_ether_addr), 0); + rte_zmalloc(NULL, sizeof(struct rte_ether_addr) * ICE_NUM_MACADDR_MAX, 0); if (!dev->data->mac_addrs) { PMD_INIT_LOG(ERR, "Failed to allocate memory to store mac address");