Skip to content

Commit

Permalink
tipc: Enhancements to name table initialization
Browse files Browse the repository at this point in the history
This patch enhances the initialization of TIPC's name table
by removing a pointless spinlock operation, and by using
kcalloc() to detect requests for an oversized name table.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Allan Stephens authored and David S. Miller committed May 12, 2008
1 parent 20c2c1f commit 4e3e6dc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions net/tipc/name_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,15 +1050,12 @@ void tipc_nametbl_dump(void)

int tipc_nametbl_init(void)
{
int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;

table.types = kzalloc(array_size, GFP_ATOMIC);
table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head),
GFP_ATOMIC);
if (!table.types)
return -ENOMEM;

write_lock_bh(&tipc_nametbl_lock);
table.local_publ_count = 0;
write_unlock_bh(&tipc_nametbl_lock);
return 0;
}

Expand Down

0 comments on commit 4e3e6dc

Please sign in to comment.