netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: bridge: add compile-time assert for cb struct size
@ 2015-03-03 12:53 Florian Westphal
  2015-03-03 13:50 ` David Laight
  2015-03-03 19:07 ` David Miller
  0 siblings, 2 replies; 9+ messages in thread
From: Florian Westphal @ 2015-03-03 12:53 UTC (permalink / raw)
  To: netdev; +Cc: Florian Westphal

make build fail if structure no longer fits into ->cb storage.

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 Change since v1: use FIELD_SIZEOF

 checkpatch complains about >80 chars, but line break is ugly here.

diff --git a/net/bridge/br.c b/net/bridge/br.c
index fb57ab6..02c24cf 100644
--- a/net/bridge/br.c
+++ b/net/bridge/br.c
@@ -190,6 +190,8 @@ static int __init br_init(void)
 {
 	int err;
 
+	BUILD_BUG_ON(sizeof(struct br_input_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
+
 	err = stp_proto_register(&br_stp_proto);
 	if (err < 0) {
 		pr_err("bridge: can't register sap for STP\n");
-- 
2.0.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-03 19:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-03-03 14:44     ` David Laight
2015-03-03 14:51       ` Eyal Birger
2015-03-03 19:07 ` David Miller

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).