From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <qiming.yang@intel.com>
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id EEE3C1B49E;
 Mon, 22 Apr 2019 08:57:50 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 21 Apr 2019 23:57:49 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,380,1549958400"; d="scan'208";a="317890056"
Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204])
 by orsmga005.jf.intel.com with ESMTP; 21 Apr 2019 23:57:49 -0700
Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by
 FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Sun, 21 Apr 2019 23:57:49 -0700
Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by
 FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Sun, 21 Apr 2019 23:57:49 -0700
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by
 SHSMSX151.ccr.corp.intel.com ([169.254.3.39]) with mapi id 14.03.0415.000;
 Mon, 22 Apr 2019 14:57:47 +0800
From: "Yang, Qiming" <qiming.yang@intel.com>
To: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH] net/ice: fix coverity issues
Thread-Index: AQHU9YWuC1zASJ9bo0CvvN7mDnlBi6ZHxkbQ
Date: Mon, 22 Apr 2019 06:57:46 +0000
Message-ID: <F5DF4F0E3AFEF648ADC1C3C33AD4DBF17A4A9184@SHSMSX101.ccr.corp.intel.com>
References: <1555551081-29524-1-git-send-email-wenzhuo.lu@intel.com>
In-Reply-To: <1555551081-29524-1-git-send-email-wenzhuo.lu@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
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] net/ice: fix coverity issues
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Apr 2019 06:57:51 -0000



-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
Sent: Thursday, April 18, 2019 9:31 AM
To: dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/ice: fix coverity issues

Fix the issues reported by Coverity check, "Null-checking vsi suggests that=
 it may be null, but it has already been dereferenced on all paths leading =
to the check."

Fixes: e0dcf94a0d7f ("net/ice: support VLAN ops")
Fixes: ff963bfa7cb1 ("net/ice: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c in=
dex 0946b19..5cca4a8 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -645,12 +645,14 @@ struct ice_xstats_name_off {
 	struct ice_fltr_list_entry *v_list_itr =3D NULL;
 	struct ice_vlan_filter *f;
 	struct LIST_HEAD_TYPE list_head;
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_hw *hw;
 	int ret =3D 0;
=20
 	if (!vsi || vlan_id > ETHER_MAX_VLAN_ID)
 		return -EINVAL;
=20
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	/* If it's added and configured, return. */
 	f =3D ice_find_vlan_filter(vsi, vlan_id);
 	if (f) {
@@ -710,7 +712,7 @@ struct ice_xstats_name_off {
 	struct ice_fltr_list_entry *v_list_itr =3D NULL;
 	struct ice_vlan_filter *f;
 	struct LIST_HEAD_TYPE list_head;
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_hw *hw;
 	int ret =3D 0;
=20
 	/**
@@ -720,6 +722,8 @@ struct ice_xstats_name_off {
 	if (!vsi || vlan_id =3D=3D 0 || vlan_id > ETHER_MAX_VLAN_ID)
 		return -EINVAL;
=20
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	/* Can't find it, return an error */
 	f =3D ice_find_vlan_filter(vsi, vlan_id);
 	if (!f)
@@ -2553,13 +2557,16 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,=
  static int  ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t l=
ut_size)  {
-	struct ice_pf *pf =3D ICE_VSI_TO_PF(vsi);
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_pf *pf;
+	struct ice_hw *hw;
 	int ret;
=20
 	if (!vsi || !lut)
 		return -EINVAL;
=20
+	pf =3D ICE_VSI_TO_PF(vsi);
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
 		ret =3D ice_aq_set_rss_lut(hw, vsi->idx, TRUE,
 					 lut, lut_size);
--
1.9.3

Acked-by: Qiming Yang <qiming.yang@intel.com>

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 81782A05D3
	for <public@inbox.dpdk.org>; Mon, 22 Apr 2019 08:57:54 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id DEBC31B4A4;
	Mon, 22 Apr 2019 08:57:52 +0200 (CEST)
Received: from mga12.intel.com (mga12.intel.com [192.55.52.136])
 by dpdk.org (Postfix) with ESMTP id EEE3C1B49E;
 Mon, 22 Apr 2019 08:57:50 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 21 Apr 2019 23:57:49 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,380,1549958400"; d="scan'208";a="317890056"
Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204])
 by orsmga005.jf.intel.com with ESMTP; 21 Apr 2019 23:57:49 -0700
Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by
 FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Sun, 21 Apr 2019 23:57:49 -0700
Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by
 FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS)
 id 14.3.408.0; Sun, 21 Apr 2019 23:57:49 -0700
Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.164]) by
 SHSMSX151.ccr.corp.intel.com ([169.254.3.39]) with mapi id 14.03.0415.000;
 Mon, 22 Apr 2019 14:57:47 +0800
From: "Yang, Qiming" <qiming.yang@intel.com>
To: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
CC: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH] net/ice: fix coverity issues
Thread-Index: AQHU9YWuC1zASJ9bo0CvvN7mDnlBi6ZHxkbQ
Date: Mon, 22 Apr 2019 06:57:46 +0000
Message-ID:
 <F5DF4F0E3AFEF648ADC1C3C33AD4DBF17A4A9184@SHSMSX101.ccr.corp.intel.com>
References: <1555551081-29524-1-git-send-email-wenzhuo.lu@intel.com>
In-Reply-To: <1555551081-29524-1-git-send-email-wenzhuo.lu@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH] net/ice: fix coverity issues
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190422065746.FZnSGwsDs2fkW9TdA65PQbrzyfgP4pvslaaPDf96WNc@z>



-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
Sent: Thursday, April 18, 2019 9:31 AM
To: dev@dpdk.org
Cc: Lu, Wenzhuo <wenzhuo.lu@intel.com>; stable@dpdk.org
Subject: [dpdk-dev] [PATCH] net/ice: fix coverity issues

Fix the issues reported by Coverity check, "Null-checking vsi suggests that=
 it may be null, but it has already been dereferenced on all paths leading =
to the check."

Fixes: e0dcf94a0d7f ("net/ice: support VLAN ops")
Fixes: ff963bfa7cb1 ("net/ice: support RSS")
Cc: stable@dpdk.org

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 drivers/net/ice/ice_ethdev.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c in=
dex 0946b19..5cca4a8 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -645,12 +645,14 @@ struct ice_xstats_name_off {
 	struct ice_fltr_list_entry *v_list_itr =3D NULL;
 	struct ice_vlan_filter *f;
 	struct LIST_HEAD_TYPE list_head;
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_hw *hw;
 	int ret =3D 0;
=20
 	if (!vsi || vlan_id > ETHER_MAX_VLAN_ID)
 		return -EINVAL;
=20
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	/* If it's added and configured, return. */
 	f =3D ice_find_vlan_filter(vsi, vlan_id);
 	if (f) {
@@ -710,7 +712,7 @@ struct ice_xstats_name_off {
 	struct ice_fltr_list_entry *v_list_itr =3D NULL;
 	struct ice_vlan_filter *f;
 	struct LIST_HEAD_TYPE list_head;
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_hw *hw;
 	int ret =3D 0;
=20
 	/**
@@ -720,6 +722,8 @@ struct ice_xstats_name_off {
 	if (!vsi || vlan_id =3D=3D 0 || vlan_id > ETHER_MAX_VLAN_ID)
 		return -EINVAL;
=20
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	/* Can't find it, return an error */
 	f =3D ice_find_vlan_filter(vsi, vlan_id);
 	if (!f)
@@ -2553,13 +2557,16 @@ static int ice_macaddr_set(struct rte_eth_dev *dev,=
  static int  ice_set_rss_lut(struct ice_vsi *vsi, uint8_t *lut, uint16_t l=
ut_size)  {
-	struct ice_pf *pf =3D ICE_VSI_TO_PF(vsi);
-	struct ice_hw *hw =3D ICE_VSI_TO_HW(vsi);
+	struct ice_pf *pf;
+	struct ice_hw *hw;
 	int ret;
=20
 	if (!vsi || !lut)
 		return -EINVAL;
=20
+	pf =3D ICE_VSI_TO_PF(vsi);
+	hw =3D ICE_VSI_TO_HW(vsi);
+
 	if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) {
 		ret =3D ice_aq_set_rss_lut(hw, vsi->idx, TRUE,
 					 lut, lut_size);
--
1.9.3

Acked-by: Qiming Yang <qiming.yang@intel.com>