[PATCH v2 10/44] net/cxgbe: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:36 CET 2023
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: cda260a4ac1a ("net/cxgbe: add option to keep outer VLAN tag in QinQ")
Fixes: dd7c9f12762e ("net/cxgbe: separate VF only devargs")
Fixes: 536db938a444 ("net/cxgbe: add devargs to control filtermode and filtermask")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/net/cxgbe/cxgbe_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index f8dd833032..2f2acbcf5a 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -746,6 +746,9 @@ void cxgbe_print_port_info(struct adapter *adap)
static int check_devargs_handler(const char *key, const char *value, void *p)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (!strncmp(key, CXGBE_DEVARG_CMN_KEEP_OVLAN, strlen(key)) ||
!strncmp(key, CXGBE_DEVARG_CMN_TX_MODE_LATENCY, strlen(key)) ||
!strncmp(key, CXGBE_DEVARG_VF_FORCE_LINK_UP, strlen(key))) {
--
2.17.1
More information about the dev
mailing list