[PATCH v2 19/44] net/ionic: fix segment fault when parse devargs
Chengwen Feng
fengchengwen at huawei.com
Mon Mar 20 10:20:45 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: 9de21005e201 ("net/ionic: add Q-in-CMB option")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/net/ionic/ionic_dev_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ionic/ionic_dev_pci.c b/drivers/net/ionic/ionic_dev_pci.c
index 5e74a6da71..5ba86c7a2e 100644
--- a/drivers/net/ionic/ionic_dev_pci.c
+++ b/drivers/net/ionic/ionic_dev_pci.c
@@ -103,6 +103,9 @@ ionic_pci_devarg_cmb(const char *key __rte_unused, const char *val, void *arg)
{
struct ionic_adapter *adapter = arg;
+ if (val == NULL)
+ return -EINVAL;
+
if (!strcmp(val, "1")) {
IONIC_PRINT(NOTICE, "%s enabled", PMD_IONIC_CMB_KVARG);
adapter->q_in_cmb = true;
--
2.17.1
More information about the dev
mailing list