Skip to contentSkip to conversation

examples/ioat: resolve unchecked return value

PATCH New Praveen Shetty 3 participants 5 messages Nov 28, 2019 – Feb 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/ioat: resolve unchecked return value

patch checks the return value of function rte_eth_dev_info_get, if return value is negative error message printed on the console.

Coverity issue: 350361

---
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
examples/ioat/ioatfwd.c +5 -1
index e9117718f..b39a098ec 100644
@@ -824,7 +824,11 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	/* Init port */
 	printf("Initializing port %u... ", portid);
 	fflush(stdout);
-	rte_eth_dev_info_get(portid, &dev_info);
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE, "Cannot get device info: %s, port=%u\n",
+			rte_strerror(-ret), portid);
+
 	local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
 		dev_info.flow_type_rss_offloads;
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 examples/ioat: resolve unchecked return value

patch checks the return value of function rte_eth_dev_info_get, if return value is negative error message printed on the console.

Coverity issue: 350361

---
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
examples/ioat/ioatfwd.c +5 -1
index e9117718f..b39a098ec 100644
@@ -824,7 +824,11 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	/* Init port */
 	printf("Initializing port %u... ", portid);
 	fflush(stdout);
-	rte_eth_dev_info_get(portid, &dev_info);
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE, "Cannot get device info: %s, port=%u\n",
+			rte_strerror(-ret), portid);
+
 	local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
 		dev_info.flow_type_rss_offloads;
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 1/1 examples/ioat: resolve unchecked return value

In reply to Praveen Shetty

patch checks the return value of function rte_eth_dev_info_get, if return value is negative error message printed on the console.

Coverity issue: 350361

Fixes c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
---
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
examples/ioat/ioatfwd.c +5 -1
index e9117718f..b39a098ec 100644
@@ -824,7 +824,11 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues)
 	/* Init port */
 	printf("Initializing port %u... ", portid);
 	fflush(stdout);
-	rte_eth_dev_info_get(portid, &dev_info);
+	ret = rte_eth_dev_info_get(portid, &dev_info);
+	if (ret < 0)
+		rte_exit(EXIT_FAILURE, "Cannot get device info: %s, port=%u\n",
+			rte_strerror(-ret), portid);
+
 	local_port_conf.rx_adv_conf.rss_conf.rss_hf &=
 		dev_info.flow_type_rss_offloads;
 	if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
Signature · 1 line
2.17.1
Acked-by on v2 1/1
#3 lore raw
Quoted 12 lines · Praveen Shetty

patch checks the return value of function rte_eth_dev_info_get, if return value is negative error message printed on the console.

Coverity issue: 350361

Fixes c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
---
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Thanks for the fix.
This is non-critical so merge can be deferred to 20.02

#4 lore raw
Quoted 7 lines · Bruce Richardson
Quoted 5 lines · Praveen Shetty

patch checks the return value of function rte_eth_dev_info_get, if return value is negative error message printed on the console.

Coverity issue: 350361

Fixes c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Quoted 7 lines
Quoted 6 lines
---
 examples/ioat/ioatfwd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 1 line
David Marchand