[dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters
Li Han
han.li1 at zte.com.cn
Mon Aug 21 10:11:17 CEST 2017
in parse_ringnuma_config/parse_portnuma_config functions,port_id
should less than RTE_MAX_ETHPORTS,but port_id_is_invalid check
assumes that port_id may be 255.
Signed-off-by: Li Han <han.li1 at zte.com.cn>
---
app/test-pmd/parameters.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
mode change 100644 => 100755 app/test-pmd/parameters.c
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
old mode 100644
new mode 100755
index 2f7f70f..99a5340
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -424,7 +424,8 @@
return -1;
}
port_id = (uint8_t)int_fld[FLD_PORT];
- if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL) {
printf("Valid port range is [0");
RTE_ETH_FOREACH_DEV(pid)
printf(", %d", pid);
@@ -483,7 +484,8 @@
return -1;
}
port_id = (uint8_t)int_fld[FLD_PORT];
- if (port_id_is_invalid(port_id, ENABLED_WARN)) {
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL) {
printf("Valid port range is [0");
RTE_ETH_FOREACH_DEV(pid)
printf(", %d", pid);
--
1.8.3.1
More information about the dev
mailing list