* [PATCH] ipv4: output metric as unsigned int
@ 2024-12-12 16:19 Maximilian Güntner
2024-12-13 12:18 ` Simon Horman
2024-12-15 21:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Maximilian Güntner @ 2024-12-12 16:19 UTC (permalink / raw)
To: netdev; +Cc: David Ahern, David S. Miller, Maximilian Güntner
adding a route metric greater than 0x7fff_ffff leads to an
unintended wrap when printing the underlying u32 as an
unsigned int (`%d`) thus incorrectly rendering the metric
as negative. Formatting using `%u` corrects the issue.
Signed-off-by: Maximilian Güntner <code@mguentner.de>
---
net/ipv4/fib_trie.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 161f5526b86c..d6411ac81096 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2999,7 +2999,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
seq_printf(seq,
"%s\t%08X\t%08X\t%04X\t%d\t%u\t"
- "%d\t%08X\t%d\t%u\t%u",
+ "%u\t%08X\t%d\t%u\t%u",
nhc->nhc_dev ? nhc->nhc_dev->name : "*",
prefix, gw, flags, 0, 0,
fi->fib_priority,
@@ -3011,7 +3011,7 @@ static int fib_route_seq_show(struct seq_file *seq, void *v)
} else {
seq_printf(seq,
"*\t%08X\t%08X\t%04X\t%d\t%u\t"
- "%d\t%08X\t%d\t%u\t%u",
+ "%u\t%08X\t%d\t%u\t%u",
prefix, 0, flags, 0, 0, 0,
mask, 0, 0, 0);
}
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ipv4: output metric as unsigned int
2024-12-12 16:19 [PATCH] ipv4: output metric as unsigned int Maximilian Güntner
@ 2024-12-13 12:18 ` Simon Horman
2024-12-15 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-12-13 12:18 UTC (permalink / raw)
To: Maximilian Güntner; +Cc: netdev, David Ahern, David S. Miller
On Thu, Dec 12, 2024 at 05:19:11PM +0100, Maximilian Güntner wrote:
> adding a route metric greater than 0x7fff_ffff leads to an
> unintended wrap when printing the underlying u32 as an
> unsigned int (`%d`) thus incorrectly rendering the metric
> as negative. Formatting using `%u` corrects the issue.
>
> Signed-off-by: Maximilian Güntner <code@mguentner.de>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ipv4: output metric as unsigned int
2024-12-12 16:19 [PATCH] ipv4: output metric as unsigned int Maximilian Güntner
2024-12-13 12:18 ` Simon Horman
@ 2024-12-15 21:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-15 21:30 UTC (permalink / raw)
To: =?utf-8?q?Maximilian_G=C3=BCntner_=3Ccode=40mguentner=2Ede=3E?=
Cc: netdev, dsahern, davem
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Thu, 12 Dec 2024 17:19:11 +0100 you wrote:
> adding a route metric greater than 0x7fff_ffff leads to an
> unintended wrap when printing the underlying u32 as an
> unsigned int (`%d`) thus incorrectly rendering the metric
> as negative. Formatting using `%u` corrects the issue.
>
> Signed-off-by: Maximilian Güntner <code@mguentner.de>
>
> [...]
Here is the summary with links:
- ipv4: output metric as unsigned int
https://git.kernel.org/netdev/net-next/c/329365dc46b8
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] 3+ messages in thread
end of thread, other threads:[~2024-12-15 21:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 16:19 [PATCH] ipv4: output metric as unsigned int Maximilian Güntner
2024-12-13 12:18 ` Simon Horman
2024-12-15 21:30 ` 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).