Skip to contentSkip to conversation

net: fix print in skb_panic()

PATCH In review gaoxingwang 3 participants 4 messages Mar 7, 2024

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

PATCH 1/1 net: fix print in skb_panic()

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")
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/skbuff.c +1 -1
index 83af8aaeb893..55173b4b3ec7 100644
@@ -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>");
Signature · 1 line
2.27.0
#1 lore raw
Quoted 4 lines · gaoxingwang

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.

#2 lore raw
Quoted 10 lines · Eric Dumazet
Quoted 4 lines · gaoxingwang

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.

#3 lore raw
In reply to gaoxingwang
Quoted 7 lines · gaoxingwang

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