On Wed, Nov 18, 2020 at 12:46 PM Ferruh Yigit <ferruh.yi...@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: sta...@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yi...@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.march...@redhat.com>


-- 
David Marchand

Reply via email to