[PATCH 3/4] app/testpmd: check for no arguments

fengchengwen fengchengwen at huawei.com
Thu Mar 12 13:37:42 CET 2026


Hi Kevin,

On 3/12/2026 6:36 PM, Kevin Traynor wrote:
> For the case where token is NULL, there are no arguments
> and split_str[0] is used uninitialized.

In which case the token is NULL, if there are no arguments, the cmdline's
callback won't be invoke.

Thanks

> 
> Check counter to ensure there is a token and return error if not.
> 
> Fixes: 601576ae6699 ("app/testpmd: add prio-tc map in DCB command")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
> ---
>  app/test-pmd/cmdline.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
> index c33c66f327..ab85f4e0ad 100644
> --- a/app/test-pmd/cmdline.c
> +++ b/app/test-pmd/cmdline.c
> @@ -3570,4 +3570,9 @@ parse_dcb_token_value(char *token_str,
>  	} while (1);
>  
> +	if (split_num == 0) {
> +		fprintf(stderr, "Bad Argument: no arguments provided\n");
> +		return -1;
> +	}
> +
>  	/* parse fixed parameter "pfc-en" first. */
>  	token = split_str[0];



More information about the dev mailing list