netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix uninit value using in tg3_setup_fiber_mii_phy()
@ 2025-10-02  9:12 Alexandr Sapozhnkiov
  2025-10-02 21:00 ` Michael Chan
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandr Sapozhnkiov @ 2025-10-02  9:12 UTC (permalink / raw)
  To: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni
  Cc: Alexandr Sapozhnikov, netdev, lvc-project

From: Alexandr Sapozhnikov <alsp705@gmail.com>

There is a way when we go to the goto fiber_setup_done label 
and the condition current_link_up && current_duplex == DUPLEX_FULL 
is met, then the tg3_setup_flow_control() function is executed with 
undefined values of local_adv and remote_adv.

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

Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 1589a49b876c..1fa61328c1b9 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -5802,7 +5802,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) &&
-- 
2.43.0


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

* Re: [PATCH] fix uninit value using in tg3_setup_fiber_mii_phy()
  2025-10-02  9:12 [PATCH] fix uninit value using in tg3_setup_fiber_mii_phy() Alexandr Sapozhnkiov
@ 2025-10-02 21:00 ` Michael Chan
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Chan @ 2025-10-02 21:00 UTC (permalink / raw)
  To: Alexandr Sapozhnkiov
  Cc: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, netdev, lvc-project

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

On Thu, Oct 2, 2025 at 2:12 AM Alexandr Sapozhnkiov <alsp705@gmail.com> wrote:
>
> From: Alexandr Sapozhnikov <alsp705@gmail.com>
>
> There is a way when we go to the goto fiber_setup_done label
> and the condition current_link_up && current_duplex == DUPLEX_FULL
> is met, then the tg3_setup_flow_control() function is executed with
> undefined values of local_adv and remote_adv.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
> Signed-off-by: Alexandr Sapozhnikov <alsp705@gmail.com>
> ---
>  drivers/net/ethernet/broadcom/tg3.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 1589a49b876c..1fa61328c1b9 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -5802,7 +5802,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;

Looks like we don't have local and remote advertisement information in
this SGMII mode, so setting them to 0 is correct.

Much further down in this function we set local_adv and remote_adv to
0 for GMII mode.  Could you remove those 2 lines now that they are no
longer needed?  Thanks.

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

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

end of thread, other threads:[~2025-10-02 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-02  9:12 [PATCH] fix uninit value using in tg3_setup_fiber_mii_phy() Alexandr Sapozhnkiov
2025-10-02 21:00 ` Michael Chan

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).