Thread (23 messages) 23 messages, 2 authors, 2016-11-22

[RFCv2 bluetooth-next 02/19] ieee802154: 6lowpan: move skb cb BUILD_BUG_ON check

flat view
STALE3621d

From: Alexander Aring <hidden>
Date: 2016-08-07 14:30:39
Subsystem: 6lowpan generic (btle/ieee 802.15.4), ieee 802.15.4 subsystem, networking [general], the rest · Maintainers: Alexander Aring, Stefan Schmidt, Miquel Raynal, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Revision v1 of 2 in this series.

Revisions (2)
  1. rfc [diff vs current]
  2. v1 current
This patch moves the control block information BUILD_BUG_ON to the init
of module. All compile timed BUILD_BUG_ON macros should be placed there.

Signed-off-by: Alexander Aring <redacted>
---
 include/net/6lowpan.h         | 1 -
 net/ieee802154/6lowpan/core.c | 3 +++
 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/net/6lowpan.h b/include/net/6lowpan.h
index 5ab4c99..6d56be7 100644
--- a/include/net/6lowpan.h
+++ b/include/net/6lowpan.h
@@ -178,7 +178,6 @@ struct lowpan_802154_cb {
 static inline
 struct lowpan_802154_cb *lowpan_802154_cb(const struct sk_buff *skb)
 {
-	BUILD_BUG_ON(sizeof(struct lowpan_802154_cb) > sizeof(skb->cb));
 	return (struct lowpan_802154_cb *)skb->cb;
 }
 
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index d7efbf0..6afb8cd 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -233,6 +233,9 @@ static int __init lowpan_init_module(void)
 {
 	int err = 0;
 
+	BUILD_BUG_ON(sizeof(struct lowpan_802154_cb) >
+		     FIELD_SIZEOF(struct sk_buff, cb));
+
 	err = lowpan_net_frag_init();
 	if (err < 0)
 		goto out;
-- 
2.9.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help