Skip to contentSkip to conversation

testpmd: Fix segment fault when port ID greater than 76

PATCH Applied Michael Qiu 2 participants 2 messages Jul 28, 2015 – Jul 29, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 testpmd: Fix segment fault when port ID greater than 76

In testpmd, when using "rx_vlan add 1 77", it will be a segment fault Because the port ID should be less than 32.

---
 app/test-pmd/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test-pmd/config.c +1 -1
index 1d29146..cf2aa6e 100644
@@ -388,7 +388,7 @@ port_id_is_invalid(portid_t port_id, enum print_warning warning)
 	if (port_id == (portid_t)RTE_PORT_ALL)
 		return 0;
 
-	if (ports[port_id].enabled)
+	if (port_id < RTE_MAX_ETHPORTS && ports[port_id].enabled)
 		return 0;
 
 	if (warning == ENABLED_WARN)
Signature · 1 line
1.9.3
#1 lore raw

2015-07-29 02:32, Michael Qiu:

Quoted 4 lines

In testpmd, when using "rx_vlan add 1 77", it will be a segment fault Because the port ID should be less than 32.

Fixes edab33b1c01d ("app/testpmd: support port hotplug")

Applied, thanks