[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 03 Mar 2015 15:28:47 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: David Laight <David.Laight@...LAB.COM>,
'Florian Westphal' <fw@...len.de>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v2] net: bridge: add compile-time assert for cb struct
size
On 03/03/2015 02:50 PM, David Laight wrote:
...
>> + BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
>> +
>
> What about using something based on:
> #define GET_CB(skb, type) ((type *)((skb)->cb + (sizeof (char[(sizeof (type) <= sizeof (skb->cb)) ? 1 : -1] - 1)))
> to access skb->sb?
That would require to change all skb->cb[] call-sites everywhere.
Besides that, this macro is also buggy, my totally untrained lisp-eye tells
me that you got your brackets wrong.
Cheers,
Daniel
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists