On 3/14/2023 12:48 PM, Chengwen Feng wrote: > The rte_kvargs_process() was used to parse KV pairs, it also supports > to parse 'only keys' (e.g. socket_id) type. And the callback function > parameter 'value' is NULL when parsed 'only keys'. > > This patch fixes segment fault when parse --pdump args with 'only keys' > (e.g. 'port,queue=*'). > > Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing") > Cc: sta...@dpdk.org > > Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
Hi Chengwen, Thanks for the fix, +1 to patch. > --- > app/pdump/main.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/app/pdump/main.c b/app/pdump/main.c > index c6cf9d9c87..d286952483 100644 > --- a/app/pdump/main.c > +++ b/app/pdump/main.c > @@ -170,6 +170,9 @@ parse_device_id(const char *key __rte_unused, const char > *value, > { > struct pdump_tuples *pt = extra_args; > > + if (value == NULL || extra_args == NULL) > + return -EINVAL; > + Do we need to check 'extra_args'? It is not something changes in the runtime, functions provides this callback is local to this file and in control, also if 'extra_args' is not provided correctly it will crash immediately so easy to detect it. But +1 to check 'value', since that depends what user provided and need to verify user input. Same comment for all set.