From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 8DC5147CE for ; Mon, 18 Apr 2016 17:56:03 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 18 Apr 2016 08:56:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,503,1455004800"; d="scan'208";a="957541760" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 18 Apr 2016 08:56:02 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 18 Apr 2016 08:56:01 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Mon, 18 Apr 2016 08:56:01 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.229]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.10]) with mapi id 14.03.0248.002; Mon, 18 Apr 2016 23:55:59 +0800 From: "Zhang, Helin" To: "Mrzyglod, DanielX T" , "Chen, Jing D" , "Wu, Jingjing" CC: "dev@dpdk.org" Thread-Topic: [PATCH] i40e: dereference before null check Thread-Index: AQHRmYnVvjXdL1L1eUmQ42GRVGZbLJ+P4hRg Date: Mon, 18 Apr 2016 15:55:59 +0000 Message-ID: References: <1460998153-187871-1-git-send-email-danielx.t.mrzyglod@intel.com> In-Reply-To: <1460998153-187871-1-git-send-email-danielx.t.mrzyglod@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYzA3NjE3MzUtYmMzMS00NzA0LTgzMmYtMzAwZWZiNWU4ZjIwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IkRuT2hSTTBrVmJMUTJTZzJING1NSXlBV1lhTTV1STEwSDM0dHhackkxNUk9In0= x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [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:56:04 -0000 > -----Original Message----- > From: Mrzyglod, DanielX T > Sent: Tuesday, April 19, 2016 12:49 AM > To: Chen, Jing D ; Wu, Jingjing ; > Zhang, Helin > Cc: dev@dpdk.org; Mrzyglod, DanielX T > Subject: [PATCH] i40e: dereference before null check >=20 > Fix issue reported by Coverity. > Coverity ID 13302: > There may be a null pointer dereference, or else the comparison against n= ull is > unnecessary. Does that really happen? I guess not. If I am correct, I'd suggest to just remove the check of if (dev =3D=3D NUL= L) as not needed. /Helin >=20 > In i40evf_config_vlan_pvid: All paths that lead to this null pointer comp= arison > already dereference the pointer earlier >=20 > Fixes: 2b12431b5369 ("i40e: add vlan stripping and insertion to VF") >=20 > Signed-off-by: Daniel Mrzyglod > --- > drivers/net/i40e/i40e_ethdev_vf.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > 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 =3D > I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); > + struct i40e_vf *vf =3D 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 =3D I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private); >=20 > memset(&tpid_info, 0, sizeof(tpid_info)); > tpid_info.vsi_id =3D vf->vsi_res->vsi_id; > -- > 2.5.5