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~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to