[dpdk-dev] [PATCH] app/testpmd: fix unchecked return value

Kalesh A P kalesh-anakkur.purayil at broadcom.com
Tue Mar 16 05:55:18 CET 2021


From: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>

CID 353629 (#1 of 1): Unchecked return value (CHECKED_RETURN)
check_return: Calling rte_eth_dev_info_get without checking
return value (as is done elsewhere 110 out of 117 times).

Coverity issue: 353629

Fixes: e1d44d0ad623 ("app/testpmd: show MAC addresses added to a port")
Cc: stable at dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil at broadcom.com>
---
 app/test-pmd/config.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 576d5ac..ade26e0 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -4927,10 +4927,15 @@ show_macs(portid_t port_id)
 	struct rte_ether_addr *addr;
 	uint32_t i, num_macs = 0;
 	struct rte_eth_dev *dev;
+	int ret;
 
 	dev = &rte_eth_devices[port_id];
 
-	rte_eth_dev_info_get(port_id, &dev_info);
+	ret = rte_eth_dev_info_get(port_id, &dev_info);
+	if (ret != 0) {
+		printf("rte_eth_dev_info_get() failed for port %u\n", port_id);
+		return;
+	}
 
 	for (i = 0; i < dev_info.max_mac_addrs; i++) {
 		addr = &dev->data->mac_addrs[i];
-- 
2.10.1



More information about the dev mailing list