From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id D3CFE2C52 for ; Mon, 5 Nov 2018 12:41:17 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4B5A422B7A; Mon, 5 Nov 2018 06:41:17 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 05 Nov 2018 06:41:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=6C06IbjjI17Y3qoKHcCiGHfwPXxmXjjzsgCPMTSzCPY=; b=jwVVFW9fY1dp Bdp0+iWOV7MiOodpopCWeB6NcvcZolaDbkGdnvTSq/mbp63DZCE4W7fHtOr03hx6 0HfzAIC2Lw8uj944U75I5E4qge0PtfuFVbOPUyukWceIhnesMe9JGj+YYQww9wS2 po+IAzA4JkSoc1qg5GoTDPpDoHPPTKU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=6C06IbjjI17Y3qoKHcCiGHfwPXxmXjjzsgCPMTSzC PY=; b=nHacbut/NtRJObIF53od2hVwUArIquWnvVuQ+J+dmw0/9rGwWknblUgVX c1B0DLHJEZNNBDdLrqogJLvJCB7AzYuOtVPkV8HbiaSMSl/RQDeXMi46X82MkbU/ PXwDZm9WiDEHps66zO/WZGgVchea+nIyiUOGXr5pVAbhATSi2hgqcsr4yDraSJE7 bGR3X7RwdzfPPQTegE3APdyhvn2sCbKs2g1Ejalcsn8fR4lFXLVTV9UpMgwr9Oly B+qhOpk6QYoMzo9Jvk54t2ICrozpgRolNKW5kDptIwbfkacc0Me+OGQlxqfU/AeJ SkUI4QLtXT7oeiYvffjzCwu8VYtbA== X-ME-Sender: X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id EB5BD10323; Mon, 5 Nov 2018 06:41:15 -0500 (EST) From: Thomas Monjalon To: Reshma Pattan Cc: dev@dpdk.org, Li Han , maryam.tahhan@intel.com Date: Mon, 05 Nov 2018 12:41:14 +0100 Message-ID: <3442683.FcHu0NKpy2@xps> In-Reply-To: <1538031669-9305-1-git-send-email-han.li1@zte.com.cn> References: <1538031669-9305-1-git-send-email-han.li1@zte.com.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [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: , X-List-Received-Date: Mon, 05 Nov 2018 11:41:18 -0000 +Cc Reshma Please could you review this patch? 27/09/2018 09:01, Li Han: > 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; > > }