netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: broadcom: Fix uninitialized lockal variable
@ 2024-10-31 17:32 George Rurikov
  2024-10-31 17:54 ` Pavan Chebbi
  0 siblings, 1 reply; 2+ messages in thread
From: George Rurikov @ 2024-10-31 17:32 UTC (permalink / raw)
  To: Pavan Chebbi
  Cc: George Rurikov, Michael Chan, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Nithin Nayak Sujir,
	netdev, linux-kernel, lvc-project, stable

I can't find any reason why it won't happen.
In SERDES_TG3_SGMII_MODE, when current_link_up == true and
current_duplex == DUPLEX_FULL, program execution will be transferred
using the goto fiber_setup_done, where the uninitialized remote_adv
variable is passed as the second parameter to the
tg3_setup_flow_control function.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 85730a631f0c ("tg3: Add SGMII phy support for 5719/5718 serdes")
Cc: stable@vger.kernel.org
Signed-off-by: George Rurikov <grurikov@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 378815917741..b1c60851c841 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -5802,7 +5802,8 @@ 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, sgsr;
+	u32 remote_adv = 0;
 
 	if ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
 	     tg3_asic_rev(tp) == ASIC_REV_5720) &&
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: ethernet: broadcom: Fix uninitialized lockal variable
  2024-10-31 17:32 [PATCH] net: ethernet: broadcom: Fix uninitialized lockal variable George Rurikov
@ 2024-10-31 17:54 ` Pavan Chebbi
  0 siblings, 0 replies; 2+ messages in thread
From: Pavan Chebbi @ 2024-10-31 17:54 UTC (permalink / raw)
  To: George Rurikov
  Cc: Michael Chan, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Nithin Nayak Sujir, netdev,
	linux-kernel, lvc-project, stable

[-- Attachment #1: Type: text/plain, Size: 1564 bytes --]

On Thu, Oct 31, 2024 at 11:02 PM George Rurikov <grurikov@gmail.com> wrote:
>
> I can't find any reason why it won't happen.
> In SERDES_TG3_SGMII_MODE, when current_link_up == true and
> current_duplex == DUPLEX_FULL, program execution will be transferred
> using the goto fiber_setup_done, where the uninitialized remote_adv
> variable is passed as the second parameter to the
> tg3_setup_flow_control function.

You mean the third parameter to the function.
BTW, does this argument not hold good for local_adv also?

>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Fixes: 85730a631f0c ("tg3: Add SGMII phy support for 5719/5718 serdes")
> Cc: stable@vger.kernel.org
> Signed-off-by: George Rurikov <grurikov@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 378815917741..b1c60851c841 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -5802,7 +5802,8 @@ 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, sgsr;
> +       u32 remote_adv = 0;
>
>         if ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
>              tg3_asic_rev(tp) == ASIC_REV_5720) &&
> --
> 2.34.1
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-31 17:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-31 17:32 [PATCH] net: ethernet: broadcom: Fix uninitialized lockal variable George Rurikov
2024-10-31 17:54 ` Pavan Chebbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).