[dpdk-dev,v2] i40e: dereference before null check

Message ID 1460999603-188184-1-git-send-email-danielx.t.mrzyglod@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Bruce Richardson
Headers

Commit Message

Daniel Mrzyglod April 18, 2016, 5:13 p.m. UTC
  Fix issue reported by Coverity.
Coverity ID 13302:
There may be a null pointer dereference, or else the comparison against
null is unnecessary.

In i40evf_config_vlan_pvid: All paths that lead to this null pointer
comparison already dereference the pointer earlier

Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")

Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Zhang, Helin April 27, 2016, 6:30 a.m. UTC | #1
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Tuesday, April 19, 2016 1:13 AM
> To: Chen, Jing D; Wu, Jingjing; Zhang, Helin
> Cc: dev@dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH v2] i40e: dereference before null check
> 
> Fix issue reported by Coverity.
> Coverity ID 13302:
> There may be a null pointer dereference, or else the comparison against null
> is unnecessary.
> 
> In i40evf_config_vlan_pvid: All paths that lead to this null pointer comparison
> already dereference the pointer earlier
> 
> Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
  
Jingjing Wu April 27, 2016, 6:34 a.m. UTC | #2
> -----Original Message-----
> From: Mrzyglod, DanielX T
> Sent: Tuesday, April 19, 2016 1:13 AM
> To: Chen, Jing D; Wu, Jingjing; Zhang, Helin
> Cc: dev@dpdk.org; Mrzyglod, DanielX T
> Subject: [PATCH v2] i40e: dereference before null check
> 
> Fix issue reported by Coverity.
> Coverity ID 13302:
> There may be a null pointer dereference, or else the comparison against null
> is unnecessary.
> 
> In i40evf_config_vlan_pvid: All paths that lead to this null pointer comparison
> already dereference the pointer earlier
> 
> Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")
> 
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
  
Bruce Richardson May 3, 2016, 10:46 a.m. UTC | #3
On Wed, Apr 27, 2016 at 06:34:03AM +0000, Wu, Jingjing wrote:
> 
> 
> > -----Original Message-----
> > From: Mrzyglod, DanielX T
> > Sent: Tuesday, April 19, 2016 1:13 AM
> > To: Chen, Jing D; Wu, Jingjing; Zhang, Helin
> > Cc: dev@dpdk.org; Mrzyglod, DanielX T
> > Subject: [PATCH v2] i40e: dereference before null check
> > 
> > Fix issue reported by Coverity.
> > Coverity ID 13302:
> > There may be a null pointer dereference, or else the comparison against null
> > is unnecessary.
> > 
> > In i40evf_config_vlan_pvid: All paths that lead to this null pointer comparison
> > already dereference the pointer earlier
> > 
> > Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF")
> > 
> > Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> Acked-by: Jingjing Wu <jingjing.wu@intel.com>
> 
Applied to dpdk-next-net/rel_16_07

/Bruce
  

Patch

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2bce69b..2d75b96 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -538,7 +538,7 @@  i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
 	struct vf_cmd_info args;
 	struct i40e_virtchnl_pvid_info tpid_info;
 
-	if (dev == NULL || info == NULL) {
+	if (info == NULL) {
 		PMD_DRV_LOG(ERR, "invalid parameters");
 		return I40E_ERR_PARAM;
 	}