This change prevents netdev_dpdk from accessing pointer
which is not valid.

Signed-off-by: Michal Weglicki <michalx.wegli...@intel.com>
---
 lib/netdev-dpdk.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 4658416..2831a1b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -1690,8 +1690,12 @@ netdev_dpdk_get_status(const struct netdev *netdev_, 
struct smap *args)
     smap_add_format(args, "max_vfs", "%u", dev_info.max_vfs);
     smap_add_format(args, "max_vmdq_pools", "%u", dev_info.max_vmdq_pools);
 
-    smap_add_format(args, "pci-vendor_id", "0x%u", 
dev_info.pci_dev->id.vendor_id);
-    smap_add_format(args, "pci-device_id", "0x%x", 
dev_info.pci_dev->id.device_id);
+    if (dev_info.pci_dev) {
+        smap_add_format(args, "pci-vendor_id", "0x%u",
+                        dev_info.pci_dev->id.vendor_id);
+        smap_add_format(args, "pci-device_id", "0x%x",
+                        dev_info.pci_dev->id.device_id);
+    }
 
     return 0;
 }
-- 
1.9.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to