netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bnx2x: truncate value to original sizing
@ 2022-03-21  2:31 Bill Wendling
  2022-03-22  9:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Wendling @ 2022-03-21  2:31 UTC (permalink / raw)
  To: Ariel Elior, Sudarsana Kalluru, Manish Chopra, David S . Miller,
	Jakub Kicinski, Nathan Chancellor, Nick Desaulniers, netdev,
	linux-kernel, llvm
  Cc: Bill Wendling

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")
Link: https://github.com/ClangBuiltLinux/linux/issues/378
Signed-off-by: Bill Wendling <morbo@google.com>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index bede16760388..7071604f9984 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -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;
 }
-- 
2.35.1.894.gb6a874cedc-goog


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

* Re: [PATCH] bnx2x: truncate value to original sizing
  2022-03-21  2:31 [PATCH] bnx2x: truncate value to original sizing Bill Wendling
@ 2022-03-22  9:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-03-22  9:50 UTC (permalink / raw)
  To: Bill Wendling
  Cc: aelior, skalluru, manishc, davem, kuba, nathan, ndesaulniers,
	netdev, linux-kernel, llvm

Hello:

This patch was applied to netdev/net-next.git (master)
by Paolo Abeni <pabeni@redhat.com>:

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")
> Link: https://github.com/ClangBuiltLinux/linux/issues/378
> Signed-off-by: Bill Wendling <morbo@google.com>
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2022-03-22  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21  2:31 [PATCH] bnx2x: truncate value to original sizing Bill Wendling
2022-03-22  9:50 ` patchwork-bot+netdevbpf

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