From patchwork Tue Nov 17 17:14:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ferruh Yigit X-Patchwork-Id: 84275 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96EC9A04E6; Tue, 17 Nov 2020 18:15:50 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BF4FFC8F2; Tue, 17 Nov 2020 18:15:06 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 6BE8D592C; Tue, 17 Nov 2020 18:15:01 +0100 (CET) IronPort-SDR: ymlE72cYXxv6bDLfUxi3n9Bkz2ZUDN4ga43PIfxzDvh2B30YA+1b9+DqRb0fHV4yDo062fLgJ/ Tm7ebQkJhYKg== X-IronPort-AV: E=McAfee;i="6000,8403,9808"; a="157997957" X-IronPort-AV: E=Sophos;i="5.77,486,1596524400"; d="scan'208";a="157997957" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2020 09:14:56 -0800 IronPort-SDR: tp9z+JQzL5zkKsgP1X1EmavPHUrrC//7DOMNbkBManylXReyLr/J9iM52z6EYdGgBbEo8fAc/J FwHLOIcmn3RQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,486,1596524400"; d="scan'208";a="330146840" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.222.180]) by orsmga006.jf.intel.com with ESMTP; 17 Nov 2020 09:14:55 -0800 From: Ferruh Yigit To: Maryam Tahhan , Reshma Pattan , Kuba Kozak Cc: Ferruh Yigit , dev@dpdk.org, stable@dpdk.org Date: Tue, 17 Nov 2020 17:14:33 +0000 Message-Id: <20201117171435.2303641-3-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201117171435.2303641-1-ferruh.yigit@intel.com> References: <20201117171435.2303641-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 2/4] app/procinfo: fix negative check on unsigned variable 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_xstats_ids()' return 'int'. The return value is assigned to 'nb_xstats_ids' unsigned value, later negative check on this variable is wrong. Adding interim 'int' variable for negative check. Fixes: 7ac16a3660c0 ("app/proc-info: support xstats by ID and by name") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit --- Cc: kubax.kozak@intel.com --- app/proc-info/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 35e5b596eb..c11fe25af4 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -301,14 +301,13 @@ proc_info_parse_args(int argc, char **argv) } else if (!strncmp(long_option[option_index].name, "xstats-ids", MAX_LONG_OPT_SZ)) { - nb_xstats_ids = parse_xstats_ids(optarg, + int ret = parse_xstats_ids(optarg, xstats_ids, MAX_NB_XSTATS_IDS); - - if (nb_xstats_ids <= 0) { + if (ret <= 0) { printf("xstats-id list parse error.\n"); return -1; } - + nb_xstats_ids = (uint32_t)ret; } break; default: