Skip to content

Commit

Permalink
[INET]: Use BUILD_BUG_ON in inet_timewait_sock.c checks
Browse files Browse the repository at this point in the history
Make the INET_TWDR_TWKILL_SLOTS vs sizeof(twdr->thread_slots)
check nicer.

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 1f9e636 commit 95c9382
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/ipv4/inet_timewait_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,14 @@ void inet_twdr_hangman(unsigned long data)

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);
Expand Down

0 comments on commit 95c9382

Please sign in to comment.