From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 3DD8A32A5 for ; Mon, 18 Apr 2016 17:49:00 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 18 Apr 2016 08:48:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,503,1455004800"; d="scan'208";a="961221901" Received: from gklab-246-025.igk.intel.com (HELO Sent) ([10.217.246.25]) by fmsmga002.fm.intel.com with SMTP; 18 Apr 2016 08:48:56 -0700 Received: by Sent (sSMTP sendmail emulation); Mon, 18 Apr 2016 18:49:15 +0200 From: Daniel Mrzyglod To: jing.d.chen@intel.com, jingjing.wu@intel.com, helin.zhang@intel.com Cc: dev@dpdk.org, Daniel Mrzyglod Date: Mon, 18 Apr 2016 18:49:13 +0200 Message-Id: <1460998153-187871-1-git-send-email-danielx.t.mrzyglod@intel.com> X-Mailer: git-send-email 2.5.5 Subject: [dpdk-dev] [PATCH] i40e: dereference before null check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2016 15:49:01 -0000 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 --- 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