From patchwork Mon Aug 21 08:11:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Han X-Patchwork-Id: 27681 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id DE3D29111; Mon, 21 Aug 2017 10:12:50 +0200 (CEST) Received: from out1.zte.com.cn (out1.zte.com.cn [202.103.147.172]) by dpdk.org (Postfix) with ESMTP id DD24B910F for ; Mon, 21 Aug 2017 10:12:47 +0200 (CEST) X-scanvirus: By SEG_CYREN AntiVirus Engine X-scanresult: CLEAN X-MAILFROM: X-RCPTTO: X-FROMIP: 10.30.3.20 X-SEG-Scaned: 1 X-Received: unknown,10.30.3.20,20170821160836 Received: from unknown (HELO mse01.zte.com.cn) (10.30.3.20) by localhost with (AES256-SHA encrypted) SMTP; 21 Aug 2017 08:08:36 -0000 Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id v7L8CJDi089556; Mon, 21 Aug 2017 16:12:19 +0800 (GMT-8) (envelope-from han.li1@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.171]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017082116122164-393374 ; Mon, 21 Aug 2017 16:12:21 +0800 From: Li Han To: jingjing.wu@intel.com Cc: dev@dpdk.org, Li Han Date: Mon, 21 Aug 2017 16:11:17 +0800 Message-Id: <1503303077-13122-1-git-send-email-han.li1@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-08-21 16:12:21, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-08-21 16:12:19, Serialize complete at 2017-08-21 16:12:19 X-MAIL: mse01.zte.com.cn v7L8CJDi089556 X-HQIP: 127.0.0.1 Subject: [dpdk-dev] [PATCH] app/testpmd:fix invalid port id parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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);