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 556C1A00E6 for ; Thu, 18 Apr 2019 03:25:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6A1E81B8C2; Thu, 18 Apr 2019 03:25:41 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 315881B8C1; Thu, 18 Apr 2019 03:25:39 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Apr 2019 18:25:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,364,1549958400"; d="scan'208";a="143644093" Received: from dpdk26.sh.intel.com ([10.67.110.164]) by orsmga003.jf.intel.com with ESMTP; 17 Apr 2019 18:25:37 -0700 From: Wenzhuo Lu To: dev@dpdk.org Cc: Wenzhuo Lu , stable@dpdk.org Date: Thu, 18 Apr 2019 09:31:21 +0800 Message-Id: <1555551081-29524-1-git-send-email-wenzhuo.lu@intel.com> X-Mailer: git-send-email 1.9.3 Subject: [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" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190418013121.w7nCfaFIlZ6w-ktYeWhcRfXXHkAErGszF41_GQuOU9E@z> 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 index 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 = NULL; struct ice_vlan_filter *f; struct LIST_HEAD_TYPE list_head; - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_hw *hw; int ret = 0; if (!vsi || vlan_id > ETHER_MAX_VLAN_ID) return -EINVAL; + hw = ICE_VSI_TO_HW(vsi); + /* If it's added and configured, return. */ f = 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 = NULL; struct ice_vlan_filter *f; struct LIST_HEAD_TYPE list_head; - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_hw *hw; int ret = 0; /** @@ -720,6 +722,8 @@ struct ice_xstats_name_off { if (!vsi || vlan_id == 0 || vlan_id > ETHER_MAX_VLAN_ID) return -EINVAL; + hw = ICE_VSI_TO_HW(vsi); + /* Can't find it, return an error */ f = 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 lut_size) { - struct ice_pf *pf = ICE_VSI_TO_PF(vsi); - struct ice_hw *hw = ICE_VSI_TO_HW(vsi); + struct ice_pf *pf; + struct ice_hw *hw; int ret; if (!vsi || !lut) return -EINVAL; + pf = ICE_VSI_TO_PF(vsi); + hw = ICE_VSI_TO_HW(vsi); + if (pf->flags & ICE_FLAG_RSS_AQ_CAPABLE) { ret = ice_aq_set_rss_lut(hw, vsi->idx, TRUE, lut, lut_size); -- 1.9.3