[PATCH v2 08/44] net/ark: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:34 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: 1502d443d885 ("net/ark: replace compile time log config with runtime")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/net/ark/ark_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b2995427c8..8baaffd746 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -898,6 +898,9 @@ process_pktdir_arg(const char *key, const char *value,
struct ark_adapter *ark =
(struct ark_adapter *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ark->pkt_dir_v = strtol(value, NULL, 16);
ARK_PMD_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v);
return 0;
--
2.17.1
More information about the dev
mailing list