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 CF0872082 for ; Tue, 6 Nov 2018 04:36:23 +0100 (CET) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id AB0797DA6EFE2015A1CD; Tue, 6 Nov 2018 11:36:22 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id wA63ZRjv069121; Tue, 6 Nov 2018 11:35:27 +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 2018110611353967-8848889 ; Tue, 6 Nov 2018 11:35:39 +0800 From: Li Han To: reshma.pattan@intel.com Cc: dev@dpdk.org, Li Han Date: Mon, 5 Nov 2018 22:04:26 -0500 Message-Id: <1541473466-27118-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-06 11:35:39, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-11-06 11:35:23, Serialize complete at 2018-11-06 11:35:23 X-MAIL: mse01.zte.com.cn wA63ZRjv069121 Subject: [dpdk-dev] [PATCH v2] app/proc-info:fix port mask parse bug 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: Tue, 06 Nov 2018 03:36:24 -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. Signed-off-by: Li Han --- 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