Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: Re: skb->truesize assertion checking for TCP
Date: Thu, 20 Apr 2006 15:04:06 +1000	[thread overview]
Message-ID: <20060420050406.GA22105@gondor.apana.org.au> (raw)
In-Reply-To: <20060419.215513.13034269.davem@davemloft.net>

Hi David:

On Wed, Apr 19, 2006 at 09:55:13PM -0700, David S. Miller wrote:
> 
> Herbert what do you think of this?
> 
> I know it might be better to check this right where we
> make the manipulations, but this catch-all trap at the
> end points seems to make sense and will catch other kinds
> of errors.

Yes that should do the trick.

> +static inline void skb_truesize_check(struct sk_buff *skb)
> +{
> +	if (unlikely((int)skb->truesize < sizeof(struct sk_buff)))
> +		skb_truesize_bug(skb);
> +}

I think we can go for the stronger test:

skb->truesize < sizeof(struct sk_buff) + skb->len

> +void skb_truesize_bug(struct sk_buff *skb)
> +{
> +	printk("SKB BUG: Invalid truesize (%u) sizeof(sk_buff)=%Zd\n",
> +	       skb->truesize, sizeof(struct sk_buff));
> +}

Printing out skb->len would be good too if we changed the test.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  reply	other threads:[~2006-04-20  5:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-20  4:55 skb->truesize assertion checking for TCP David S. Miller
2006-04-20  5:04 ` Herbert Xu [this message]
2006-04-20  6:17   ` David S. Miller
2006-04-25 16:49     ` Jesse Brandeburg

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=20060420050406.GA22105@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --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