diff mbox

[ovs-dev] netdev_dpdk: pci_dev pointer check.

Message ID 1AFA2937E172CD4DB2FD9318443C060EE0B96C@IRSMSX103.ger.corp.intel.com
State Accepted
Headers show

Commit Message

Weglicki, MichalX Dec. 21, 2015, 10:04 a.m. UTC
Hello, 

Is it possible to merge this patch? It is quite simple, and very important for integration with DPDK 2.2. 

Br, 
Michal. 

-----Original Message-----
From: Weglicki, MichalX 
Sent: Thursday, December 3, 2015 7:30 AM
To: dev@openvswitch.org
Cc: Weglicki, MichalX <michalx.weglicki@intel.com>
Subject: [PATCH] netdev_dpdk: pci_dev pointer check.

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

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

Comments

Ben Pfaff Dec. 22, 2015, 12:09 a.m. UTC | #1
It looks obviously correct to me but I guess that Daniele or Pravin
should apply it.

On Mon, Dec 21, 2015 at 10:04:55AM +0000, Weglicki, MichalX wrote:
> Hello, 
> 
> Is it possible to merge this patch? It is quite simple, and very important for integration with DPDK 2.2. 
> 
> Br, 
> Michal. 
> 
> -----Original Message-----
> From: Weglicki, MichalX 
> Sent: Thursday, December 3, 2015 7:30 AM
> To: dev@openvswitch.org
> Cc: Weglicki, MichalX <michalx.weglicki@intel.com>
> Subject: [PATCH] netdev_dpdk: pci_dev pointer check.
> 
> This change prevents netdev_dpdk from accessing pointer
> which is not valid.
> 
> Signed-off-by: Michal Weglicki <michalx.weglicki@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
> 
> --------------------------------------------------------------
> Intel Research and Development Ireland Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
> 
> 
> This e-mail and any attachments may contain confidential material for the sole
> use of the intended recipient(s). Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient, please contact the
> sender and delete all copies.
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

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;
 }