From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Han Subject: [PATCH] app/proc-info:fix port mask parse bug Date: Thu, 27 Sep 2018 03:01:09 -0400 Message-ID: <1538031669-9305-1-git-send-email-han.li1@zte.com.cn> Cc: dev@dpdk.org, Li Han To: maryam.tahhan@intel.com Return-path: Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) by dpdk.org (Postfix) with ESMTP id A759E1B12E for ; Thu, 27 Sep 2018 09:26:19 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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..5b06735 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -90,7 +90,7 @@ /* * Parse the portmask provided at run time. */ -static int +static uint32_t parse_portmask(const char *portmask) { char *end = NULL; @@ -103,13 +103,10 @@ 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; + return (uint32_t)pm; } -- 1.8.3.1