netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix print in skb_panic()
@ 2024-03-07  6:11 gaoxingwang
  2024-03-07  6:29 ` Eric Dumazet
  2024-03-07  9:13 ` Breno Leitao
  0 siblings, 2 replies; 4+ messages in thread
From: gaoxingwang @ 2024-03-07  6:11 UTC (permalink / raw)
  To: netdev, linux-kernel, davem, edumazet, kuba; +Cc: liaichun, yanan

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

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


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

* Re: [PATCH] net: fix print in skb_panic()
  2024-03-07  6:11 [PATCH] net: fix print in skb_panic() gaoxingwang
@ 2024-03-07  6:29 ` Eric Dumazet
  2024-03-07  9:19   ` Breno Leitao
  2024-03-07  9:13 ` Breno Leitao
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Dumazet @ 2024-03-07  6:29 UTC (permalink / raw)
  To: gaoxingwang; +Cc: netdev, linux-kernel, davem, kuba, liaichun, yanan

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.

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

* Re: [PATCH] net: fix print in skb_panic()
  2024-03-07  6:11 [PATCH] net: fix print in skb_panic() gaoxingwang
  2024-03-07  6:29 ` Eric Dumazet
@ 2024-03-07  9:13 ` Breno Leitao
  1 sibling, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2024-03-07  9:13 UTC (permalink / raw)
  To: gaoxingwang; +Cc: netdev, linux-kernel, davem, edumazet, kuba, liaichun, yanan

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>

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

* Re: [PATCH] net: fix print in skb_panic()
  2024-03-07  6:29 ` Eric Dumazet
@ 2024-03-07  9:19   ` Breno Leitao
  0 siblings, 0 replies; 4+ messages in thread
From: Breno Leitao @ 2024-03-07  9:19 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: gaoxingwang, netdev, linux-kernel, davem, kuba, liaichun, yanan

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.

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

end of thread, other threads:[~2024-03-07  9:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07  6:11 [PATCH] net: fix print in skb_panic() gaoxingwang
2024-03-07  6:29 ` Eric Dumazet
2024-03-07  9:19   ` Breno Leitao
2024-03-07  9:13 ` Breno Leitao

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