OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] Use BUILD_BUG_ON in inet_timewait_sock.c checks
[PATCH] Use BUILD_BUG_ON in inet_timewait_sock.c checks [message #24679] Fri, 07 December 2007 17:46 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
Make the INET_TWDR_TWKILL_SLOTS vs sizeof(twdr->thread_slots)
check nicer.

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

---

diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c
index a60b99e..d43e787 100644
--- a/net/ipv4/inet_timewait_sock.c
+++ b/net/ipv4/inet_timewait_sock.c
@@ -194,16 +194,14 @@ out:
 
 EXPORT_SYMBOL_GPL(inet_twdr_hangman);
 
-extern void twkill_slots_invalid(void);
-
 void inet_twdr_twkill_work(struct work_struct *work)
 {
 	struct inet_timewait_death_row *twdr =
 		container_of(work, struct inet_timewait_death_row, twkill_work);
 	int i;
 
-	if ((INET_TWDR_TWKILL_SLOTS - 1) > (sizeof(twdr->thread_slots) * 8))
-		twkill_slots_invalid();
+	BUILD_BUG_ON((INET_TWDR_TWKILL_SLOTS - 1) >
+			(sizeof(twdr->thread_slots) * 8));
 
 	while (twdr->thread_slots) {
 		spin_lock_bh(&twdr->death_lock);
Re: [PATCH] Use BUILD_BUG_ON in inet_timewait_sock.c checks [message #24838 is a reply to message #24679] 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:46:10 +0300

> Make the INET_TWDR_TWKILL_SLOTS vs sizeof(twdr->thread_slots)
> check nicer.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Also applied to net-2.6.25, thanks!
Previous Topic: [PATCH] Use BUILD_BUG_ON for tcp_skb_cb size checking
Next Topic: [PATCH net-2.6.25] Cleanup IN_DEV_MFORWARD macro
Goto Forum:
  


Current Time: Sat Apr 13 06:34:31 GMT 2024

Total time taken to generate the page: 0.01583 seconds