projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab2cedb
)
ipv4: output metric as unsigned int
author
Maximilian Güntner
<code@mguentner.de>
Thu, 12 Dec 2024 16:19:11 +0000
(17:19 +0100)
committer
Jakub Kicinski
<kuba@kernel.org>
Sun, 15 Dec 2024 21:13:40 +0000
(13:13 -0800)
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>
Link:
https://patch.msgid.link/20241212161911.51598-1-code@mguentner.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/fib_trie.c
patch
|
blob
|
blame
|
history
diff --git
a/net/ipv4/fib_trie.c
b/net/ipv4/fib_trie.c
index 161f5526b86c6cf6a90f94cd296825a8301f0654..d6411ac810961a0b78a5b5c8263e217b69b033e0 100644
(file)
--- 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);
}