From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 81782A05D3 for ; 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" To: "Lu, Wenzhuo" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "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: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 ; 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 --- 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