From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.217.80.70]) by dpdk.org (Postfix) with ESMTP id 9217C1D7 for ; Wed, 7 Nov 2018 07:41:22 +0100 (CET) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 705DEAD6F2980F3AF1C5; Wed, 7 Nov 2018 14:41:20 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wA76f1Pd086405; Wed, 7 Nov 2018 14:41:01 +0800 (GMT-8) (envelope-from han.li1@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.165]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2018110714412249-9132658 ; Wed, 7 Nov 2018 14:41:22 +0800 From: Li Han To: reshma.pattan@intel.com Cc: dev@dpdk.org, Li Han Date: Wed, 7 Nov 2018 01:10:09 -0500 Message-Id: <1541571009-12396-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 2018-11-07 14:41:22, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-07 14:40:53, Serialize complete at 2018-11-07 14:40:53 X-MAIL: mse01.zte.com.cn wA76f1Pd086405 Subject: [dpdk-dev] [PATCH v3] app/proc-info: fix port mask parse issue 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: , X-List-Received-Date: Wed, 07 Nov 2018 06:41:23 -0000 parse_portmask return type is int,but global variable "enabled_port_mask" type is uint32_t.so in proc_info_parse_args function,when parse_portmask return -1,"enabled_port_mask" will get a huge value and "if (enabled_port_mask == 0)" will never happen. Fixes: 22561383ea17 ("app: replace dump_cfg by proc_info") Signed-off-by: Li Han --- v3: *fix commit meassges issue v2: *fix typecast issue --- app/proc-info/main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index c20effa..650d599 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -37,7 +37,7 @@ #define MAX_STRING_LEN 256 /**< mask of enabled ports */ -static uint32_t enabled_port_mask; +static uint64_t enabled_port_mask; /**< Enable stats. */ static uint32_t enable_stats; /**< Enable xstats. */ @@ -90,7 +90,7 @@ /* * Parse the portmask provided at run time. */ -static int +static unsigned long parse_portmask(const char *portmask) { char *end = NULL; @@ -103,12 +103,9 @@ if ((portmask[0] == '\0') || (end == NULL) || (*end != '\0') || (errno != 0)) { printf("%s ERROR parsing the port mask\n", __func__); - return -1; + return 0; } - if (pm == 0) - return -1; - return pm; } -- 1.8.3.1