From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 230F631E0F4; Mon, 27 Oct 2025 18:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591567; cv=none; b=nfZwfeBwo8/svKzkmKYDkJ8Me6Spcuoapxrr2hb2GTerdHEcgXaQ885ziiW76/U/nCNGX4ZtFbfyjXS00X+t/3YKZTeJyQaDHJcrRaegbgXo9Ry2bL/IG2zzNJncOGWzn8NknulTA62EIMp7N7x1K5gawPpwNBTd/Q4S2c+HPMo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591567; c=relaxed/simple; bh=tKCU4D8eL7yqFnhVdVfU5zPTLG+POf2x0EzEEYAmNpQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mm/Rt3gEQACQcnja0+2v3Ue6rA5q5UccZSnUqjVAKUfRyfgqgUdlF+nljnnQKw7akvHpLK80hlELXlR6srsuIooeGa76RsnVkN1ojbIu9NUwvR7a5rVhDdL4QMK+GlaUGOvZORwP0xDGLRFJyXD9e6b68QbeYzrw2n+IKn1Axww= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=g4mFnlJq; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="g4mFnlJq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A97C2C4CEF1; Mon, 27 Oct 2025 18:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761591567; bh=tKCU4D8eL7yqFnhVdVfU5zPTLG+POf2x0EzEEYAmNpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g4mFnlJqs1KgV0cV3G0ba+2MATuqGulVRRS8/0/o4SY/RpFTdVTXiabg7WoeEuKf5 XlpoVB4WXK0t3mfTcRk4gNgiOBKHjwfFyk2RD7iUyNqcGgyg4ylOI+GFEtc38NhAOD oGqlQPtpZH8t6nGBdOpnOuG9Mlt2iqhMXtcyoF4M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alexandr Sapozhnikov , Alexey Simakov , Pavan Chebbi , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 246/332] tg3: prevent use of uninitialized remote_adv and local_adv variables Date: Mon, 27 Oct 2025 19:34:59 +0100 Message-ID: <20251027183531.332835749@linuxfoundation.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251027183524.611456697@linuxfoundation.org> References: <20251027183524.611456697@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Simakov [ Upstream commit 0c3f2e62815a43628e748b1e4ad97a1c46cce703 ] Some execution paths that jump to the fiber_setup_done label could leave the remote_adv and local_adv variables uninitialized and then use it. Initialize this variables at the point of definition to avoid this. Fixes: 85730a631f0c ("tg3: Add SGMII phy support for 5719/5718 serdes") Co-developed-by: Alexandr Sapozhnikov Signed-off-by: Alexandr Sapozhnikov Signed-off-by: Alexey Simakov Reviewed-by: Pavan Chebbi Link: https://patch.msgid.link/20251014164736.5890-1-bigalex934@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/tg3.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index a7e8f13bb9761..e8be9e5a244fd 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -5821,7 +5821,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset) u32 current_speed = SPEED_UNKNOWN; u8 current_duplex = DUPLEX_UNKNOWN; bool current_link_up = false; - u32 local_adv, remote_adv, sgsr; + u32 local_adv = 0, remote_adv = 0, sgsr; if ((tg3_asic_rev(tp) == ASIC_REV_5719 || tg3_asic_rev(tp) == ASIC_REV_5720) && @@ -5962,9 +5962,6 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset) else current_duplex = DUPLEX_HALF; - local_adv = 0; - remote_adv = 0; - if (bmcr & BMCR_ANENABLE) { u32 common; -- 2.51.0