Skip to contentSkip to conversation

tg3: fix bug caused by uninitialized variable

PATCH Applied Heiner Kallweit 4 participants 4 messages Feb 9, 2024 – Feb 12, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tg3: fix bug caused by uninitialized variable

The reported bug is caused by using mii_eee_cap1_mod_linkmode_t() with an uninitialized bitmap. Fix this by zero-initializing the struct containing the bitmap.

Fixes 9bc791341bc9a5c22b ("tg3: convert EEE handling to use linkmode bitmaps")
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +1 -1
index 50f674031..7d0a2f5f3 100644
@@ -4616,7 +4616,7 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
 
 static bool tg3_phy_eee_config_ok(struct tg3 *tp)
 {
-	struct ethtool_keee eee;
+	struct ethtool_keee eee = {};
 
 	if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
 		return true;
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Heiner Kallweit

The reported bug is caused by using mii_eee_cap1_mod_linkmode_t() with an uninitialized bitmap. Fix this by zero-initializing the struct containing the bitmap.

Fixes 9bc791341bc9a5c22b ("tg3: convert EEE handling to use linkmode bitmaps")
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +1 -2
index 50f674031..7d0a2f5f3 100644
@@ -4616,7 +4616,7 @@ static int tg3_init_5401phy_dsp(struct tg3 *tp)
 
 static bool tg3_phy_eee_config_ok(struct tg3 *tp)
 {
-       struct ethtool_keee eee;
+       struct ethtool_keee eee = {};
 
        if (!(tp->phy_flags & TG3_PHYFLG_EEE_CAP))
                return true;
--
Quoted 3 lines

2.43.0

Thanks.

Reviewed-by on v1 1/1
#2 lore raw
In reply to Heiner Kallweit
Quoted 8 lines · Heiner Kallweit

The reported bug is caused by using mii_eee_cap1_mod_linkmode_t() with an uninitialized bitmap. Fix this by zero-initializing the struct containing the bitmap.

Fixes 9bc791341bc9a5c22b ("tg3: convert EEE handling to use linkmode bitmaps")

Andrew

#3 lore raw
In reply to Heiner Kallweit
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:

Quoted 10 lines · On Fri, 9 Feb 2024 07:47:39 +0100 you wrote:

The reported bug is caused by using mii_eee_cap1_mod_linkmode_t() with an uninitialized bitmap. Fix this by zero-initializing the struct containing the bitmap.

Fixes 9bc791341bc9a5c22b ("tg3: convert EEE handling to use linkmode bitmaps")

[...]

Here is the summary with links:
- [net-next] tg3: fix bug caused by uninitialized variable

    https://git.kernel.org/netdev/net-next/c/0972d1d979cc

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html