[PATCH v2 14/44] net/fm10k: fix segment fault when parse devargs

Chengwen Feng fengchengwen at huawei.com
Mon Mar 20 10:20:40 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: 7958b1310d5e ("fm10k: enable FTAG based forwarding")
Cc: stable at dpdk.org

Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
 drivers/net/fm10k/fm10k_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8b83063f0a..2096c6ffab 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2873,6 +2873,9 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
 static int ftag_check_handler(__rte_unused const char *key,
 		const char *value, __rte_unused void *opaque)
 {
+	if (value == NULL)
+		return -EINVAL;
+
 	if (strcmp(value, "1"))
 		return -1;
 
-- 
2.17.1



More information about the dev mailing list