[dpdk-stable] patch 'ethdev: fix build with gcc 5.4.0' has been queued to stable release 17.05.2

Yuanhan Liu yliu at fridaylinux.org
Mon Aug 21 11:30:16 CEST 2017


Hi,

FYI, your patch has been queued to stable release 17.05.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 08/24/17. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From bcd11232917ebd5994a2dc1225b57c98bc48b78d Mon Sep 17 00:00:00 2001
From: Thomas Monjalon <thomas at monjalon.net>
Date: Thu, 6 Jul 2017 23:45:32 +0200
Subject: [PATCH] ethdev: fix build with gcc 5.4.0

[ upstream commit 722de4c3e7b11d20f7b0c6e68e1b0ecb91fe6c43 ]

Seen on Ubuntu 16.04 with GCC 5.4.0:

lib/librte_ether/rte_ethdev.c: In function 'get_mac_addr_index':
lib/librte_ether/rte_ethdev.c:2369:26: error:
'dev_info.max_mac_addrs' may be used uninitialized in this function

Indeed, rte_eth_dev_info_get() do not write into dev_info
if the port_id is not valid.
So we need to check the port_id and return in case of error.

This extra check should not be needed because the port_id is always
checked before calling get_mac_addr_index().
However it does not hurt.

Reported-by: Matan Azrad <matan at mellanox.com>
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
Tested-by: Matan Azrad <matan at mellanox.com>
---
 lib/librte_ether/rte_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 83898a8..2d442a9 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -2351,6 +2351,7 @@ get_mac_addr_index(uint8_t port_id, const struct ether_addr *addr)
 	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
 	unsigned i;
 
+	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	rte_eth_dev_info_get(port_id, &dev_info);
 
 	for (i = 0; i < dev_info.max_mac_addrs; i++)
-- 
2.7.4



More information about the stable mailing list