diff mbox series

net: fix print in skb_panic()

Message ID 20240307061143.989505-1-gaoxingwang1@huawei.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series net: fix print in skb_panic() | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be 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: 942 this patch: 942
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 1 maintainers not CCed: pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 957 this patch: 957
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: 958 this patch: 958
netdev/checkpatch warning WARNING: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'.
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-03-07--09-00 (tests: 891)

Commit Message

gaoxingwang March 7, 2024, 6:11 a.m. UTC
skb->len and sz are printed as negative numbers during the panic:
skbuff: skb_under_panic: text:ffffffff8e2d3eac len:-1961180312 put:-1961180408 head:ffff88800b6ac000 data:ffff887f804ffe78 tail:0x1e0 end:0xec0 dev:team0

Use %u to print skb->len and sz,because they are defined as unsigned int.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: gaoxingwang <gaoxingwang1@huawei.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Eric Dumazet March 7, 2024, 6:29 a.m. UTC | #1
On Thu, Mar 7, 2024 at 7:12 AM gaoxingwang <gaoxingwang1@huawei.com> wrote:
>
> skb->len and sz are printed as negative numbers during the panic:
> skbuff: skb_under_panic: text:ffffffff8e2d3eac len:-1961180312 put:-1961180408 head:ffff88800b6ac000 data:ffff887f804ffe78 tail:0x1e0 end:0xec0 dev:team0
>

This was on purpose.

I prefer the negative values, I find this more useful to immediately
spot the issue.

Thank you.
Breno Leitao March 7, 2024, 9:13 a.m. UTC | #2
On Thu, Mar 07, 2024 at 02:11:43PM +0800, gaoxingwang wrote:
> skb->len and sz are printed as negative numbers during the panic:
> skbuff: skb_under_panic: text:ffffffff8e2d3eac len:-1961180312 put:-1961180408 head:ffff88800b6ac000 data:ffff887f804ffe78 tail:0x1e0 end:0xec0 dev:team0
> 
> Use %u to print skb->len and sz,because they are defined as unsigned int.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: gaoxingwang <gaoxingwang1@huawei.com>

Reviwed-by: Breno Leitao <leitao@debian.org>
Breno Leitao March 7, 2024, 9:19 a.m. UTC | #3
On Thu, Mar 07, 2024 at 07:29:47AM +0100, Eric Dumazet wrote:
> On Thu, Mar 7, 2024 at 7:12 AM gaoxingwang <gaoxingwang1@huawei.com> wrote:
> >
> > skb->len and sz are printed as negative numbers during the panic:
> > skbuff: skb_under_panic: text:ffffffff8e2d3eac len:-1961180312 put:-1961180408 head:ffff88800b6ac000 data:ffff887f804ffe78 tail:0x1e0 end:0xec0 dev:team0
> >
> 
> This was on purpose.
> 
> I prefer the negative values, I find this more useful to immediately
> spot the issue.

I missed this reply, sorry. Please ignore my previous reviewed-by. I
didn't have this context.
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 83af8aaeb893..55173b4b3ec7 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -186,7 +186,7 @@  EXPORT_SYMBOL_GPL(drop_reasons_unregister_subsys);
 static void skb_panic(struct sk_buff *skb, unsigned int sz, void *addr,
 		      const char msg[])
 {
-	pr_emerg("%s: text:%px len:%d put:%d head:%px data:%px tail:%#lx end:%#lx dev:%s\n",
+	pr_emerg("%s: text:%px len:%u put:%u head:%px data:%px tail:%#lx end:%#lx dev:%s\n",
 		 msg, addr, skb->len, sz, skb->head, skb->data,
 		 (unsigned long)skb->tail, (unsigned long)skb->end,
 		 skb->dev ? skb->dev->name : "<NULL>");