From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B8C86A04DD for ; Wed, 18 Nov 2020 15:10:48 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B0514C8FC; Wed, 18 Nov 2020 15:10:47 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by dpdk.org (Postfix) with ESMTP id 513E2C8FC for ; Wed, 18 Nov 2020 15:10:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605708643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=oxKyPY55XWlBiuz3d5XxX0Q84+anG+FhoEVqI1FtIVo=; b=fe2C/Mn9OTE3S5CxvzmDPIUIJo/3hm0uG3FhMwm0UUTlAIiagNcPg8T6+PxQBP+kMp+2/P 5xHzcvFu1I4ZuphdLRS2DHKpqAP2wbCB4S8caNqsX2w0p4uBPYSvuU+IgvYtE1Mv53zgYN wgkmEdxmy/bqmrMe4Beba+OxnMjwN6E= Received: from mail-vs1-f70.google.com (mail-vs1-f70.google.com [209.85.217.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-180-ZbfFxEDhMAesSFVB6EFehg-1; Wed, 18 Nov 2020 09:10:42 -0500 X-MC-Unique: ZbfFxEDhMAesSFVB6EFehg-1 Received: by mail-vs1-f70.google.com with SMTP id u14so263204vsp.2 for ; Wed, 18 Nov 2020 06:10:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oxKyPY55XWlBiuz3d5XxX0Q84+anG+FhoEVqI1FtIVo=; b=Jvv/qVBgHjkqbNlpzYaWTNSV1ptFM9hyfP516cNG/0h2C+aFu/cnrpdRS8uDPpA/lZ xV3wx+Zcg6qc16yvH5Urp5CafyX3OgJhEceCCnkgxh5eoXDMS4LzhnNllEI0Uly4lT/r zYjSxaSlm90plYYh1fPvK+1ReTvPArJbqUA5MVXwb8+2ncz7se2kCbHVorpql81ScaAS EDQjPWzFCo5fHBJkHz7v3w67vOKMfyNV3/jOXeMJrctVtxLk9NTaDALYIO9Z1h6lv6lt KA+Mez3+v6wQQNbYM3cMhs4prJ/Mta73I4MhhJh7v50w0FgUQPFpeL2hKgyQs3LoPgsl EaqA== X-Gm-Message-State: AOAM531OSnpSOQO/q3wZY6EFJm1+ovX4lXVWzAh/bE8BJvp+c/b0zLuf 7LQzMd53bUy8i3UIL4yfPcwzuZRbcdq/KOWp00oMXdBCRePJYFdP3oYhSrTwBbpvK6/OtM2lu56 MC6dHT8Py863qmOcthtw8Qvg= X-Received: by 2002:a67:f8c5:: with SMTP id c5mr3328153vsp.18.1605708641746; Wed, 18 Nov 2020 06:10:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJyx5PsU1LxHOAAt2Rpr7yHXqimIl+TYB8VFoMurjNAzy18/MBDEv/DlicquqnTLmRpkt7jVCdpLyIHJMtCo8hY= X-Received: by 2002:a67:f8c5:: with SMTP id c5mr3328134vsp.18.1605708641579; Wed, 18 Nov 2020 06:10:41 -0800 (PST) MIME-Version: 1.0 References: <20201117171435.2303641-1-ferruh.yigit@intel.com> <20201118114525.99053-1-ferruh.yigit@intel.com> <20201118114525.99053-3-ferruh.yigit@intel.com> In-Reply-To: <20201118114525.99053-3-ferruh.yigit@intel.com> From: David Marchand Date: Wed, 18 Nov 2020 15:10:30 +0100 Message-ID: To: Ferruh Yigit Cc: Maryam Tahhan , Reshma Pattan , Kuba Kozak , dev , dpdk stable Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] [PATCH v2 2/7] app/procinfo: fix negative check on unsigned variable X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Wed, Nov 18, 2020 at 12:46 PM Ferruh Yigit wrote: > > '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 > --- > 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; The cast is unneeded. Reviewed-by: David Marchand -- David Marchand