From: Michael Qiu Date: Tue, 28 Jul 2015 18:32:15 +0000 (+0800) Subject: app/testpmd: fix crash when port id out of bound X-Git-Tag: spdx-start~8596 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;ds=sidebyside;h=78ef434ae2829f4bfb717784d1dc21a9bf1e663e;p=dpdk.git app/testpmd: fix crash when port id out of bound 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") Signed-off-by: Michael Qiu --- diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1d2914640b..cf2aa6e46c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -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)