From: David Marchand <david.marchand@redhat.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Maryam Tahhan <maryam.tahhan@intel.com>,
Reshma Pattan <reshma.pattan@intel.com>,
Kuba Kozak <kubax.kozak@intel.com>, dev <dev@dpdk.org>,
dpdk stable <stable@dpdk.org>
Subject: Re: [dpdk-stable] [PATCH v2 2/7] app/procinfo: fix negative check on unsigned variable
Date: Wed, 18 Nov 2020 15:10:30 +0100 [thread overview]
Message-ID: <CAJFAV8xSF1EAfw2aN+eym+QKtZ6LKQTJ9yvwdOmAy6jAMzwXcg@mail.gmail.com> (raw)
In-Reply-To: <20201118114525.99053-3-ferruh.yigit@intel.com>
On Wed, Nov 18, 2020 at 12:46 PM Ferruh Yigit <ferruh.yigit@intel.com> 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 <ferruh.yigit@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;
The cast is unneeded.
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
David Marchand
next prev parent reply other threads:[~2020-11-18 14:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201117171435.2303641-1-ferruh.yigit@intel.com>
2020-11-17 17:14 ` [dpdk-stable] [PATCH 1/4] app/procinfo: fix redundant condition Ferruh Yigit
2020-11-17 17:14 ` [dpdk-stable] [PATCH 2/4] app/procinfo: fix negative check on unsigned variable Ferruh Yigit
2020-11-17 17:14 ` [dpdk-stable] [PATCH 3/4] app/procinfo: remove suspicious sizeof Ferruh Yigit
2020-11-17 18:07 ` Varghese, Vipin
2020-11-17 17:14 ` [dpdk-stable] [PATCH 4/4] app/procinfo: remove useless assignment Ferruh Yigit
2020-11-17 18:04 ` Varghese, Vipin
2020-11-18 10:46 ` Ferruh Yigit
[not found] ` <20201118114525.99053-1-ferruh.yigit@intel.com>
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 1/7] app/procinfo: fix redundant condition Ferruh Yigit
2020-11-18 14:10 ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-11-19 9:34 ` Ferruh Yigit
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 2/7] app/procinfo: fix negative check on unsigned variable Ferruh Yigit
2020-11-18 14:10 ` David Marchand [this message]
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 3/7] app/procinfo: remove suspicious sizeof Ferruh Yigit
2020-11-18 14:10 ` David Marchand
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 4/7] app/procinfo: remove useless assignment Ferruh Yigit
2020-11-18 14:11 ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 5/7] net/pcap: remove local variable shadown outer one Ferruh Yigit
2020-11-18 14:11 ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 6/7] net/af_xdp: remove useless assignment Ferruh Yigit
2020-11-18 14:42 ` [dpdk-stable] [dpdk-dev] " David Marchand
2020-11-18 11:45 ` [dpdk-stable] [PATCH v2 7/7] net/bnxt: fix redundant return Ferruh Yigit
2020-11-18 14:42 ` David Marchand
2020-11-18 16:12 ` Ajit Khaparde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8xSF1EAfw2aN+eym+QKtZ6LKQTJ9yvwdOmAy6jAMzwXcg@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=kubax.kozak@intel.com \
--cc=maryam.tahhan@intel.com \
--cc=reshma.pattan@intel.com \
--cc=stable@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).