DPDK patches and discussions
 help / color / mirror / Atom feed
From: Li Han <han.li1@zte.com.cn>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org, Li Han <han.li1@zte.com.cn>
Subject: [dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters
Date: Mon, 21 Aug 2017 16:11:17 +0800	[thread overview]
Message-ID: <1503303077-13122-1-git-send-email-han.li1@zte.com.cn> (raw)

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@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

             reply	other threads:[~2017-08-21  8:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21  8:11 Li Han [this message]
2017-08-22  2:31 Li Han
     [not found] <1503378222-23306-1-git-send-email-han.li1@zte.com.cn>
2017-09-04 14:11 ` Rybalchenko, Kirill
2017-09-07  8:44   ` Wu, Jingjing
2017-10-09  4:16 ` Ferruh Yigit
2017-10-09  4:57   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503303077-13122-1-git-send-email-han.li1@zte.com.cn \
    --to=han.li1@zte.com.cn \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).