From: Ferruh Yigit Date: Thu, 19 Nov 2020 11:58:52 +0000 (+0000) Subject: app/procinfo: fix check on xstats-ids X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=59b981c6f69cb1c705bfb93890ce8cc2a8bcdfb5;p=dpdk.git app/procinfo: fix check on xstats-ids '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 Reviewed-by: David Marchand --- diff --git a/app/proc-info/main.c b/app/proc-info/main.c index 35e5b596eb..8ee30ddb71 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 = ret; } break; default: