DPDK patches and discussions
 help / color / mirror / Atom feed
From: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
To: jing.d.chen@intel.com, jingjing.wu@intel.com, helin.zhang@intel.com
Cc: dev@dpdk.org, Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
Subject: [dpdk-dev] [PATCH] i40e: dereference before null check
Date: Mon, 18 Apr 2016 18:49:13 +0200	[thread overview]
Message-ID: <1460998153-187871-1-git-send-email-danielx.t.mrzyglod@intel.com> (raw)

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 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 2bce69b..0d69322 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -533,7 +533,7 @@ static int
 i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
 				struct i40e_vsi_vlan_pvid_info *info)
 {
-	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+	struct i40e_vf *vf = NULL;
 	int err;
 	struct vf_cmd_info args;
 	struct i40e_virtchnl_pvid_info tpid_info;
@@ -542,6 +542,7 @@ i40evf_config_vlan_pvid(struct rte_eth_dev *dev,
 		PMD_DRV_LOG(ERR, "invalid parameters");
 		return I40E_ERR_PARAM;
 	}
+	vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	memset(&tpid_info, 0, sizeof(tpid_info));
 	tpid_info.vsi_id = vf->vsi_res->vsi_id;
-- 
2.5.5

             reply	other threads:[~2016-04-18 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 16:49 Daniel Mrzyglod [this message]
2016-04-18 15:55 ` Zhang, Helin
2016-04-18 17:13 ` [dpdk-dev] [PATCH v2] " Daniel Mrzyglod
2016-04-27  6:30   ` Zhang, Helin
2016-04-27  6:34   ` Wu, Jingjing
2016-05-03 10:46     ` Bruce Richardson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460998153-187871-1-git-send-email-danielx.t.mrzyglod@intel.com \
    --to=danielx.t.mrzyglod@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jing.d.chen@intel.com \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).