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 input args with 'only keys'. > > Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD") > Fixes: 2f865ed07bb6 ("net/memif: use abstract socket address") > Cc: sta...@dpdk.org > > Signed-off-by: Chengwen Feng <fengcheng...@huawei.com>
<...> > @@ -1889,6 +1913,9 @@ memif_set_mac(const char *key __rte_unused, const char > *value, void *extra_args) > { > struct rte_ether_addr *ether_addr = (struct rte_ether_addr *)extra_args; > > + if (value == NULL || extra_args == NULL) > + return -EINVAL; > + > if (rte_ether_unformat_addr(value, ether_addr) < 0) > MIF_LOG(WARNING, "Failed to parse mac '%s'.", value); Not related to the patch, but to record it, it seems public 'rte_ether_unformat_addr()' API is missing parameter verification, we need to fix it.