From patchwork Mon Mar 4 05:37:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ma, WenwuX" X-Patchwork-Id: 137841 X-Patchwork-Delegate: bruce.richardson@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6290443B81; Mon, 4 Mar 2024 06:51:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8B58040273; Mon, 4 Mar 2024 06:51:37 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id 775A240041; Mon, 4 Mar 2024 06:51:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709531496; x=1741067496; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cs3nOALhkwdXYnP955gvIlNPDthLSnXwPyP2TMuKspI=; b=UeRu62D8IO+OJNCdB3eeENxxBwhSEQyUGom1jhr480LyAh4T9lFePgP5 +MxwS+BW87tK7M8ToMPnmN5TARdr9ujFvJ5lz4Ujoygc6GnyFvviIempc YNFBIBHmiEJ6Epc7zsxPeqaGTe5vaS1wKObBnHkQ/L53rVfbXe0p7SKku b2y60gKbNuAyIh+2bboeKMn0+V0oQKmfv/uN1o46oEMyJJJzOKbxsc7cR xW1BUL+W8G2UDwGjhsSi0JlJon19aZO2DC6PLlfkhcQz5NucE4bBZSx1D 1yKVkqcYb3+YY2QHeihjR0oJ2LbnIa/Ir5dnmSXYTbM7q4mVUShydwxhl w==; X-IronPort-AV: E=McAfee;i="6600,9927,11002"; a="14647958" X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="14647958" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2024 21:51:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,203,1705392000"; d="scan'208";a="13456509" Received: from unknown (HELO localhost.localdomain) ([10.239.252.55]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2024 21:51:31 -0800 From: Wenwu Ma To: dev@dpdk.org Cc: songx.jiale@intel.com, Wenwu Ma , stable@dpdk.org Subject: [PATCH v2] net/ice: fix null pointer dereferences Date: Mon, 4 Mar 2024 13:37:51 +0800 Message-Id: <20240304053751.567348-1-wenwux.ma@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240301052029.543989-1-wenwux.ma@intel.com> References: <20240301052029.543989-1-wenwux.ma@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org This patch fixes two null pointer dereferences detected by coverity scan. Coverity issue: 414096 Fixes: 6ccef90ff5d3 ("net/ice: support VSI level bandwidth config") Cc: stable@dpdk.org Signed-off-by: Wenwu Ma Reviewed-by: Bruce Richardson --- v2: - deleting rather than modifying the prints that cause null pointer dereferences --- drivers/net/ice/ice_tm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/net/ice/ice_tm.c b/drivers/net/ice/ice_tm.c index fbab0b8808..17f0ca0ce0 100644 --- a/drivers/net/ice/ice_tm.c +++ b/drivers/net/ice/ice_tm.c @@ -615,10 +615,8 @@ static int ice_set_node_rate(struct ice_hw *hw, sched_node, ICE_MAX_BW, rate); - if (status) { - PMD_DRV_LOG(ERR, "Failed to set max bandwidth for node %u", tm_node->id); + if (status) return -EINVAL; - } if (reset || committed == 0) rate = ICE_SCHED_DFLT_BW; @@ -629,10 +627,8 @@ static int ice_set_node_rate(struct ice_hw *hw, sched_node, ICE_MIN_BW, rate); - if (status) { - PMD_DRV_LOG(ERR, "Failed to set min bandwidth for node %u", tm_node->id); + if (status) return -EINVAL; - } return 0; }