From 1d049dc7623e4c0506c9c34dbb168ad9530daae0 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Thu, 14 May 2020 01:52:17 +0530 Subject: [PATCH] examples/l3fwd-graph: check link query failure Fix unchecked return values reported by coverity. Coverity issue: 350601 Fixes: ef853f1fd979 ("examples/l3fwd-graph: add ethdev configuration changes") Signed-off-by: Pavan Nikhilesh Acked-by: Nithin Dabilpuram --- examples/l3fwd-graph/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c index 40108a0d3a..c70270c4d1 100644 --- a/examples/l3fwd-graph/main.c +++ b/examples/l3fwd-graph/main.c @@ -598,6 +598,7 @@ check_all_ports_link_status(uint32_t port_mask) uint8_t count, all_ports_up, print_flag = 0; struct rte_eth_link link; uint16_t portid; + int ret; printf("\nChecking link status"); fflush(stdout); @@ -612,7 +613,14 @@ check_all_ports_link_status(uint32_t port_mask) if ((port_mask & (1 << portid)) == 0) continue; memset(&link, 0, sizeof(link)); - rte_eth_link_get_nowait(portid, &link); + ret = rte_eth_link_get_nowait(portid, &link); + if (ret < 0) { + all_ports_up = 0; + if (print_flag == 1) + printf("Port %u link get failed: %s\n", + portid, rte_strerror(-ret)); + continue; + } /* Print link status if flag set */ if (print_flag == 1) { if (link.link_status) -- 2.20.1