[v2,19/44] net/ionic: fix segment fault when parse devargs

Message ID 20230320092110.37295-20-fengchengwen@huawei.com (mailing list archive)
State Changes Requested, archived
Delegated to: Thomas Monjalon
Headers
Series fix segment fault when parse args |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

fengchengwen March 20, 2023, 9:20 a.m. UTC
  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@dpdk.org

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

Patch

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;