netdev_dpdk: pci_dev pointer check.
authormweglicx <michalx.weglicki@intel.com>
Thu, 3 Dec 2015 07:30:16 +0000 (23:30 -0800)
committerPravin B Shelar <pshelar@nicira.com>
Tue, 22 Dec 2015 20:35:34 +0000 (12:35 -0800)
This change prevents netdev_dpdk from accessing pointer
which is not valid.

Signed-off-by: Michal Weglicki <michalx.weglicki@intel.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/netdev-dpdk.c

index e3a0771..b209df2 100644 (file)
@@ -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;
 }