net/ring: fix return value check
authorFerruh Yigit <ferruh.yigit@intel.com>
Tue, 23 Apr 2019 15:23:32 +0000 (16:23 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 3 May 2019 16:45:23 +0000 (18:45 +0200)
'rte_eth_dev_get_port_by_name()' return value is not checked caught by
coverity, adding return value check.

Coverity issue: 305853
Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/net/ring/rte_eth_ring.c

index 979993f..ab963a0 100644 (file)
@@ -396,7 +396,11 @@ rte_eth_from_rings(const char *name, struct rte_ring *const rx_queues[],
                return -1;
        }
 
-       rte_eth_dev_get_port_by_name(ring_name, &port_id);
+       ret = rte_eth_dev_get_port_by_name(ring_name, &port_id);
+       if (ret) {
+               rte_errno = ENODEV;
+               return -1;
+       }
 
        return port_id;
 }