* [dpdk-dev] [PATCH] ethdev: don't look for devices if none were found
@ 2016-11-19 13:10 Anatoly Burakov
2016-12-07 18:08 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Anatoly Burakov @ 2016-11-19 13:10 UTC (permalink / raw)
To: dev
Aside from avoiding doing useless work, this also fixes a segfault
when calling rte_eth_dev_get_port_by_name() whenever no devices
were found yet, and therefore rte_eth_dev_data wasn't yet allocated.
Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
lib/librte_ether/rte_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index fde8112..76a6dbf 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -376,6 +376,9 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
return -EINVAL;
}
+ if (!nb_ports)
+ return -ENODEV;
+
*port_id = RTE_MAX_ETHPORTS;
for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
--
2.5.5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] ethdev: don't look for devices if none were found
2016-11-19 13:10 [dpdk-dev] [PATCH] ethdev: don't look for devices if none were found Anatoly Burakov
@ 2016-12-07 18:08 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-12-07 18:08 UTC (permalink / raw)
To: Anatoly Burakov; +Cc: dev
2016-11-19 13:10, Anatoly Burakov:
> Aside from avoiding doing useless work, this also fixes a segfault
> when calling rte_eth_dev_get_port_by_name() whenever no devices
> were found yet, and therefore rte_eth_dev_data wasn't yet allocated.
>
> Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Title reworded: "ethdev: fix port lookup if none"
Applied, thanks
PS: your patches are not in patchwork because a strange character in
an email header and a bug in patchwork that I thought was fixed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-12-07 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 13:10 [dpdk-dev] [PATCH] ethdev: don't look for devices if none were found Anatoly Burakov
2016-12-07 18:08 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).