netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: David Laight <David.Laight@ACULAB.COM>,
	'Florian Westphal' <fw@strlen.de>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH v2] net: bridge: add compile-time assert for cb struct size
Date: Tue, 03 Mar 2015 15:28:47 +0100	[thread overview]
Message-ID: <54F5C51F.5020906@iogearbox.net> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAF3BB7@AcuExch.aculab.com>

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

  parent reply	other threads:[~2015-03-03 14:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 12:53 [PATCH v2] net: bridge: add compile-time assert for cb struct size Florian Westphal
2015-03-03 13:50 ` David Laight
2015-03-03 14:07   ` Eric Dumazet
2015-03-03 14:15     ` David Laight
2015-03-03 14:33       ` Eric Dumazet
2015-03-03 14:28   ` Daniel Borkmann [this message]
2015-03-03 14:44     ` David Laight
2015-03-03 14:51       ` Eyal Birger
2015-03-03 19:07 ` David Miller

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=54F5C51F.5020906@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=fw@strlen.de \
    --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;
as well as URLs for NNTP newsgroup(s).