Skip to content

Commit 0c3f2e6

Browse files
jtstrskuba-moo
authored andcommitted
tg3: prevent use of uninitialized remote_adv and local_adv variables
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: 85730a6 ("tg3: Add SGMII phy support for 5719/5718 serdes") Co-developed-by: Alexandr Sapozhnikov <[email protected]> Signed-off-by: Alexandr Sapozhnikov <[email protected]> Signed-off-by: Alexey Simakov <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent bc38496 commit 0c3f2e6

File tree

1 file changed

+1
-4
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+1
-4
lines changed

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5803,7 +5803,7 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)
58035803
u32 current_speed = SPEED_UNKNOWN;
58045804
u8 current_duplex = DUPLEX_UNKNOWN;
58055805
bool current_link_up = false;
5806-
u32 local_adv, remote_adv, sgsr;
5806+
u32 local_adv = 0, remote_adv = 0, sgsr;
58075807

58085808
if ((tg3_asic_rev(tp) == ASIC_REV_5719 ||
58095809
tg3_asic_rev(tp) == ASIC_REV_5720) &&
@@ -5944,9 +5944,6 @@ static int tg3_setup_fiber_mii_phy(struct tg3 *tp, bool force_reset)
59445944
else
59455945
current_duplex = DUPLEX_HALF;
59465946

5947-
local_adv = 0;
5948-
remote_adv = 0;
5949-
59505947
if (bmcr & BMCR_ANENABLE) {
59515948
u32 common;
59525949

0 commit comments

Comments
 (0)