Skip to contentSkip to conversation

bnx2x: truncate value to original sizing

PATCH Applied Bill Wendling 2 participants 2 messages Mar 21, 2022 – Mar 22, 2022

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

PATCH 1/1 bnx2x: truncate value to original sizing

The original behavior was to print out unsigned short or unsigned char values. The change in commit d65aea8e8298 ("bnx2x: use correct format characters") prints out the whole value if not truncated. So truncate the value to an unsigned {short|char} to retain the original behavior.

Fixes d65aea8e8298 ("bnx2x: use correct format characters")
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +4 -2
index bede16760388..7071604f9984 100644
@@ -6178,7 +6178,8 @@ static int bnx2x_format_ver(u32 num, u8 *str, u16 *len)
 		return -EINVAL;
 	}
 
-	ret = scnprintf(str, *len, "%x.%x", num >> 16, num);
+	ret = scnprintf(str, *len, "%x.%x", (num >> 16) & 0xFFFF,
+			num & 0xFFFF);
 	*len -= ret;
 	return 0;
 }
@@ -6193,7 +6194,8 @@ static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len)
 		return -EINVAL;
 	}
 
-	ret = scnprintf(str, *len, "%x.%x.%x", num >> 16, num >> 8, num);
+	ret = scnprintf(str, *len, "%x.%x.%x", (num >> 16) & 0xFF,
+			(num >> 8) & 0xFF, num & 0xFF);
 	*len -= ret;
 	return 0;
 }
Signature · 1 line
2.35.1.894.gb6a874cedc-goog
#1 lore raw
This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (master) by Paolo Abeni <[email protected]>:

Quoted 10 lines · On Sun, 20 Mar 2022 19:31:55 -0700 you wrote:

The original behavior was to print out unsigned short or unsigned char values. The change in commit d65aea8e8298 ("bnx2x: use correct format characters") prints out the whole value if not truncated. So truncate the value to an unsigned {short|char} to retain the original behavior.

Fixes d65aea8e8298 ("bnx2x: use correct format characters")

[...]

Here is the summary with links:
- bnx2x: truncate value to original sizing

    https://git.kernel.org/netdev/net-next/c/4723832fa63f

You are awesome, thank you!

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