[PATCH 5/5] net/sfc: fix segment fault when parse devargs

Ferruh Yigit ferruh.yigit at amd.com
Thu Mar 16 19:20:47 CET 2023


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: 9e7fc8b8f3be ("net/sfc: add device parameter to choose FW variant")
> Fixes: c22d3c508e0c ("net/sfc: support parameter to choose performance profile")
> Fixes: 63d588ff2692 ("net/sfc: libefx-based driver stub")
> Fixes: df1bfde4ff0d ("net/sfc: factor out libefx-based Rx datapath")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>

<...>

> index 783cb43ae6..f77c4af345 100644
> --- a/drivers/net/sfc/sfc_kvargs.c
> +++ b/drivers/net/sfc/sfc_kvargs.c
> @@ -85,6 +85,9 @@ sfc_kvarg_bool_handler(__rte_unused const char *key,
>  	};
>  	bool *value = opaque;
>  
> +	if (!key || !opaque)
> +		return -EINVAL;


s/key/value_str/ ?

And better to be consistent with compression syntax,
`!ptr` vs `ptr == NULL"



More information about the dev mailing list