net/ifc: add devargs pointer check

Message ID 20190716113107.32868-1-xiao.w.wang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/ifc: add devargs pointer check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Xiao Wang July 16, 2019, 11:31 a.m. UTC
  We need to check devargs pointer before dereference it, if no devargs
specified then this driver just skips the device.

Fixes: 40ef35f4a504 ("net/ifc: detect if VDPA mode is specified")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 drivers/net/ifc/ifcvf_vdpa.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Qi Zhang July 17, 2019, 2:28 a.m. UTC | #1
> -----Original Message-----
> From: Wang, Xiao W
> Sent: Tuesday, July 16, 2019 7:31 PM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wang, Xiao W <xiao.w.wang@intel.com>
> Subject: [PATCH] net/ifc: add devargs pointer check
> 
> We need to check devargs pointer before dereference it, if no devargs specified
> then this driver just skips the device.
> 
> Fixes: 40ef35f4a504 ("net/ifc: detect if VDPA mode is specified")
> 
> Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> ---

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel

Thanks
Qi
  

Patch

diff --git a/drivers/net/ifc/ifcvf_vdpa.c b/drivers/net/ifc/ifcvf_vdpa.c
index e59084034..8de9ef199 100644
--- a/drivers/net/ifc/ifcvf_vdpa.c
+++ b/drivers/net/ifc/ifcvf_vdpa.c
@@ -1114,6 +1114,9 @@  ifcvf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	if (!pci_dev->device.devargs)
+		return 1;
+
 	kvlist = rte_kvargs_parse(pci_dev->device.devargs->args,
 			ifcvf_valid_arguments);
 	if (kvlist == NULL)