[dpdk-dev] [PATCH 17.11] lib/librte_ether/rte_ethdev.c: Check device count
Talal Irfan
talal.irfan at emumba.com
Tue Apr 7 18:25:23 CEST 2020
Bugzilla ID: 6
Cc: dev at dpdk.org
Cc: Thomas Monjalon <thomas at monjalon.net>
Cc: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
Cc: stable at dpdk.org
Reported-by: Wang Zhike <wangzhike at jd.com>
Suggested-by: Vipin Varghese <vipin.varghese at intel.com>
Signed-off-by: Talal Irfan <talal.irfan at emumba.com>
---
lib/librte_ether/rte_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 318af2869..ac19baf0c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -376,6 +376,12 @@ rte_eth_dev_attach(const char *devargs, uint16_t *port_id)
goto err;
}
+ if (current <= 0) {
+ RTE_LOG(ERR, EAL, "No port found for device (%s)\n", name);
+ ret = -EINVAL;
+ goto err;
+ }
+
/* parse devargs, then retrieve device name and args */
if (rte_eal_parse_devargs_str(devargs, &name, &args))
goto err;
--
2.17.1
More information about the dev
mailing list