Skip to content

Commit

Permalink
[TCP]: Use BUILD_BUG_ON for tcp_skb_cb size checking
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Jan 28, 2008
1 parent ea72912 commit 1f9e636
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2563,7 +2563,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;
Expand All @@ -2582,9 +2581,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",
Expand Down

0 comments on commit 1f9e636

Please sign in to comment.