From 59b981c6f69cb1c705bfb93890ce8cc2a8bcdfb5 Mon Sep 17 00:00:00 2001 From: Ferruh Yigit Date: Thu, 19 Nov 2020 11:58:52 +0000 Subject: [PATCH] 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 --- 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..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: -- 2.20.1