diff mbox series

[net-next] tg3: fix bug caused by uninitialized variable

Message ID 3e4a74f6-3a3b-478d-b09a-6fb29b0f8252@gmail.com (mailing list archive)
State Accepted
Commit 0972d1d979ccfd2b71ef36a5a2b1ad092be21bb9
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tg3: fix bug caused by uninitialized variable | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 996 this patch: 996
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 1006 this patch: 1006
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1017 this patch: 1017
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 9bc791341bc9 ("tg3: convert EEE handling to use linkmode bitmaps")'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-10--12-00 (tests: 1262)

Commit Message

Heiner Kallweit Feb. 9, 2024, 6:47 a.m. UTC
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")
Reported-by: Srikanth Aithal <sraithal@amd.com>
Tested-by: Srikanth Aithal <sraithal@amd.com>
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavan Chebbi Feb. 9, 2024, 7:27 a.m. UTC | #1
On Fri, Feb 9, 2024 at 12:17 PM Heiner Kallweit <hkallweit1@gmail.com> 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")
> Reported-by: Srikanth Aithal <sraithal@amd.com>
> Tested-by: Srikanth Aithal <sraithal@amd.com>
> Signed-off-by: Heiner Kallweit <hkallweit1@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 50f674031..7d0a2f5f3 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -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;
> --
> 2.43.0
>
>
Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Thanks.
Andrew Lunn Feb. 9, 2024, 1:42 p.m. UTC | #2
On Fri, Feb 09, 2024 at 07:47:39AM +0100, Heiner Kallweit 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")
> Reported-by: Srikanth Aithal <sraithal@amd.com>
> Tested-by: Srikanth Aithal <sraithal@amd.com>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
patchwork-bot+netdevbpf@kernel.org Feb. 12, 2024, 11:20 a.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

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")
> Reported-by: Srikanth Aithal <sraithal@amd.com>
> Tested-by: Srikanth Aithal <sraithal@amd.com>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> [...]

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!
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 50f674031..7d0a2f5f3 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -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;