Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
Chengwen Feng
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: 4410c1b0c0a2 ("bus/pci: add iteration filter on address")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/bus/pci/pci_params.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c index d24cc201b8..b8bee6a6c1 100644 --- a/drivers/bus/pci/pci_params.c +++ b/drivers/bus/pci/pci_params.c @@ -34,6 +34,8 @@ pci_addr_kv_cmp(const char *key __rte_unused, struct rte_pci_addr *addr1 = &_addr1; struct rte_pci_addr *addr2 = _addr2; + if (value == NULL) + return -EINVAL; if (rte_pci_addr_parse(value, addr1)) return -1; return -abs(rte_pci_addr_cmp(addr1, addr2));