From patchwork Thu Sep 27 07:01:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Han X-Patchwork-Id: 45481 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 427831B12E; Thu, 27 Sep 2018 09:26:35 +0200 (CEST) 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) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id F02639C6E17AED5DDF8F; Thu, 27 Sep 2018 15:26:05 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id w8R7PmsV048994; Thu, 27 Sep 2018 15:25:48 +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 2018092715261777-1404749 ; Thu, 27 Sep 2018 15:26:17 +0800 From: Li Han To: maryam.tahhan@intel.com Cc: dev@dpdk.org, Li Han Date: Thu, 27 Sep 2018 03:01:09 -0400 Message-Id: <1538031669-9305-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-09-27 15:26:18, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2018-09-27 15:25:36, Serialize complete at 2018-09-27 15:25:36 X-MAIL: mse01.zte.com.cn w8R7PmsV048994 Subject: [dpdk-dev] [PATCH] 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: , 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; }