From: Johannes Berg <johannes@sipsolutions.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
netdev <netdev@vger.kernel.org>
Subject: [RFC/T] [NET] give truesize warning when truesize differs
Date: Sun, 04 May 2008 20:12:08 +0200 [thread overview]
Message-ID: <1209924728.3655.7.camel@johannes.berg> (raw)
This patch makes the truesize warning be printed when the truesize
actually changed, not just when the header was increased and the
additional size actually used.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
It'll trigger with mac80211, should hold it until I fixed that.
include/linux/skbuff.h | 8 ++++++--
net/core/skbuff.c | 10 ++++++++--
2 files changed, 14 insertions(+), 4 deletions(-)
--- everything.orig/include/linux/skbuff.h 2008-05-03 15:47:00.000000000 +0200
+++ everything/include/linux/skbuff.h 2008-05-04 00:30:34.000000000 +0200
@@ -387,9 +387,13 @@ extern void skb_truesize_bug(struc
static inline void skb_truesize_check(struct sk_buff *skb)
{
- int len = sizeof(struct sk_buff) + skb->len;
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ int len = sizeof(struct sk_buff) + skb->end;
+#else
+ int len = sizeof(struct sk_buff) + (skb->end - skb->head);
+#endif
- if (unlikely((int)skb->truesize < len))
+ if (unlikely((int)skb->truesize != len))
skb_truesize_bug(skb);
}
--- everything.orig/net/core/skbuff.c 2008-05-03 16:29:23.000000000 +0200
+++ everything/net/core/skbuff.c 2008-05-04 00:31:32.000000000 +0200
@@ -151,9 +151,15 @@ void skb_under_panic(struct sk_buff *skb
void skb_truesize_bug(struct sk_buff *skb)
{
+#ifdef NET_SKBUFF_DATA_USES_OFFSET
+ int len = sizeof(struct sk_buff) + skb->end;
+#else
+ int len = sizeof(struct sk_buff) + (skb->end - skb->head);
+#endif
+
printk(KERN_ERR "SKB BUG: Invalid truesize (%u) "
- "len=%u, sizeof(sk_buff)=%Zd\n",
- skb->truesize, skb->len, sizeof(struct sk_buff));
+ "size=%u, sizeof(sk_buff)=%Zd\n",
+ skb->truesize, len, sizeof(struct sk_buff));
}
EXPORT_SYMBOL(skb_truesize_bug);
next reply other threads:[~2008-05-04 18:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-04 18:12 Johannes Berg [this message]
2008-05-04 22:09 ` [RFC/T] [NET] give truesize warning when truesize differs Johannes Berg
2008-05-05 13:11 ` Johannes Berg
2008-05-05 15:04 ` Herbert Xu
2008-05-05 15:22 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1209924728.3655.7.camel@johannes.berg \
--to=johannes@sipsolutions.net \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox