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 05F6330F526; Mon, 27 Oct 2025 19:04:15 +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=1761591855; cv=none; b=Fm+k6Tfz/8fqQisa0XDIhqMtlGnDyeb1nTIRY1OmcKLonjwDgG3nCddXT3SS3Aj1GS7Jwp+zKVifcnf48RgeJsgyMCXOJCVX1j5Jtwfq+PtTMN6r0FJ4+nxLzLeDF+/Q/jqkKS2NINvtjEjKJLLtgW7NqsX7bX1o4H4wySJOebo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761591855; c=relaxed/simple; bh=/GnT3qzSvxuFIIzNokBgIyk8mCNYKskprayxk8VNCRQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VD0nE2aADbtBBdaHQlsl94i6vK52X9iC3/9kMudf3zNoQYm53gm8Ebk9Yd1kEgS9WTpxhxp6FlHQZOy8kLQNJkc8hMQbxr2ZUKZqTsKU2YLRHaGzdKvxhUwTMhByvuC+ZE7Pnz+2GPZwDLKyIl2ehwUd8ifi9CcV1iZuGicJr3c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0MtVGCrF; 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="0MtVGCrF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B64AC4CEF1; Mon, 27 Oct 2025 19:04:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1761591854; bh=/GnT3qzSvxuFIIzNokBgIyk8mCNYKskprayxk8VNCRQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0MtVGCrFaZwd5Gkg+4w2lONBQRnftqlCkzbzUg3oc/3c8EyBTmdU5teeeH9HcQZLF oVofOeeHygsSsizeFQWHLUi4aR3oNa5yQooJRrfQQrdTvBFoyYy+2l5uf6eRcKvfEp Z2mOnayR/GurAUW25s1OOXbUn5Vw2dCpn2oK206s= 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.15 023/123] tg3: prevent use of uninitialized remote_adv and local_adv variables Date: Mon, 27 Oct 2025 19:35:03 +0100 Message-ID: <20251027183447.018419869@linuxfoundation.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251027183446.381986645@linuxfoundation.org> References: <20251027183446.381986645@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.15-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 7c51b9b593afc..bd3b56c7aab8d 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -5815,7 +5815,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) && @@ -5956,9 +5956,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