aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2006-09-01 03:29:06 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:18:15 -0400
commitef047f5e1085d6393748d1ee27d6327905f098dc (patch)
treeb1ac74cd97e5e39afedbecbffd8feaf59458d3d8
parent366e4adc0f9ef33f56c62f980a7d83775e64abd0 (diff)
[NET]: Use BUILD_BUG_ON() for checking size of skb->cb.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/af_inet.c5
-rw-r--r--net/ipv6/af_inet6.c7
-rw-r--r--net/netlink/af_netlink.c5
-rw-r--r--net/unix/af_unix.c5
4 files changed, 5 insertions, 17 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f2e8927f4596..fdd89e37b9aa 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1254,10 +1254,7 @@ static int __init inet_init(void)
1254 struct list_head *r; 1254 struct list_head *r;
1255 int rc = -EINVAL; 1255 int rc = -EINVAL;
1256 1256
1257 if (sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb)) { 1257 BUILD_BUG_ON(sizeof(struct inet_skb_parm) > sizeof(dummy_skb->cb));
1258 printk(KERN_CRIT "%s: panic\n", __FUNCTION__);
1259 goto out;
1260 }
1261 1258
1262 rc = proto_register(&tcp_prot, 1); 1259 rc = proto_register(&tcp_prot, 1);
1263 if (rc) 1260 if (rc)
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index fc9c8a99bea6..bf6e8aff19d4 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -761,6 +761,8 @@ static int __init inet6_init(void)
761 struct list_head *r; 761 struct list_head *r;
762 int err; 762 int err;
763 763
764 BUILD_BUG_ON(sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb));
765
764#ifdef MODULE 766#ifdef MODULE
765#if 0 /* FIXME --RR */ 767#if 0 /* FIXME --RR */
766 if (!mod_member_present(&__this_module, can_unload)) 768 if (!mod_member_present(&__this_module, can_unload))
@@ -770,11 +772,6 @@ static int __init inet6_init(void)
770#endif 772#endif
771#endif 773#endif
772 774
773 if (sizeof(struct inet6_skb_parm) > sizeof(dummy_skb->cb)) {
774 printk(KERN_CRIT "inet6_proto_init: size fault\n");
775 return -EINVAL;
776 }
777
778 err = proto_register(&tcpv6_prot, 1); 775 err = proto_register(&tcpv6_prot, 1);
779 if (err) 776 if (err)
780 goto out; 777 goto out;
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index a80e4456e204..d56e0d21f919 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1762,8 +1762,6 @@ static struct net_proto_family netlink_family_ops = {
1762 .owner = THIS_MODULE, /* for consistency 8) */ 1762 .owner = THIS_MODULE, /* for consistency 8) */
1763}; 1763};
1764 1764
1765extern void netlink_skb_parms_too_large(void);
1766
1767static int __init netlink_proto_init(void) 1765static int __init netlink_proto_init(void)
1768{ 1766{
1769 struct sk_buff *dummy_skb; 1767 struct sk_buff *dummy_skb;
@@ -1775,8 +1773,7 @@ static int __init netlink_proto_init(void)
1775 if (err != 0) 1773 if (err != 0)
1776 goto out; 1774 goto out;
1777 1775
1778 if (sizeof(struct netlink_skb_parms) > sizeof(dummy_skb->cb)) 1776 BUILD_BUG_ON(sizeof(struct netlink_skb_parms) > sizeof(dummy_skb->cb));
1779 netlink_skb_parms_too_large();
1780 1777
1781 nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL); 1778 nl_table = kcalloc(MAX_LINKS, sizeof(*nl_table), GFP_KERNEL);
1782 if (!nl_table) 1779 if (!nl_table)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index de6ec519272e..7c91c2024d49 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -2060,10 +2060,7 @@ static int __init af_unix_init(void)
2060 int rc = -1; 2060 int rc = -1;
2061 struct sk_buff *dummy_skb; 2061 struct sk_buff *dummy_skb;
2062 2062
2063 if (sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)) { 2063 BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb));
2064 printk(KERN_CRIT "%s: panic\n", __FUNCTION__);
2065 goto out;
2066 }
2067 2064
2068 rc = proto_register(&unix_proto, 1); 2065 rc = proto_register(&unix_proto, 1);
2069 if (rc != 0) { 2066 if (rc != 0) {