OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Use BUILD_BUG_ON for tcp_skb_cb size checking
[PATCH] Use BUILD_BUG_ON for tcp_skb_cb size checking [message #24678] Fri, 07 December 2007 17:42 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
The sizeof(struct tcp_skb_cb) should not be less than the
sizeof(skb->cb). This is checked in net/ipv4/tcp.c, but
this check can be made more gracefully.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 8e65182..c8bebd3 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -2411,7 +2411,6 @@ void tcp_done(struct sock *sk)
 }
 EXPORT_SYMBOL_GPL(tcp_done);
 
-extern void __skb_cb_too_small_for_tcp(int, int);
 extern struct tcp_congestion_ops tcp_reno;
 
 static __initdata unsigned long thash_entries;
@@ -2430,9 +2429,7 @@ void __init tcp_init(void)
 	unsigned long limit;
 	int order, i, max_share;
 
-	if (sizeof(struct tcp_skb_cb) > sizeof(skb->cb))
-		__skb_cb_too_small_for_tcp(sizeof(struct tcp_skb_cb),
-					   sizeof(skb->cb));
+	BUILD_BUG_ON(sizeof(struct tcp_skb_cb) > sizeof(skb->cb));
 
 	tcp_hashinfo.bind_bucket_cachep =
 		kmem_cache_create("tcp_bind_bucket",
Re: [PATCH] Use BUILD_BUG_ON for tcp_skb_cb size checking [message #24837 is a reply to message #24678] Tue, 11 December 2007 10:12 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Fri, 07 Dec 2007 20:42:04 +0300

> The sizeof(struct tcp_skb_cb) should not be less than the
> sizeof(skb->cb). This is checked in net/ipv4/tcp.c, but
> this check can be made more gracefully.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Applied to net-2.6.25, thanks.
Previous Topic: [PATCH 2.6.25] UNIX: remove unused declaration of sysctl_unix_max_dgram_qlen
Next Topic: [PATCH] Use BUILD_BUG_ON in inet_timewait_sock.c checks
Goto Forum:
  


Current Time: Sat Apr 13 05:55:31 GMT 2024

Total time taken to generate the page: 0.01594 seconds