summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2008-05-12 15:41:53 -0700
committerDavid S. Miller <davem@davemloft.net>2008-05-12 15:41:53 -0700
commit4e3e6dcb43c3669a8817cb3d0f920f91661afd98 (patch)
tree84b83811790add972a3a47ee378afd44b011a47d
parent20c2c1fd6c842caf70dcb1d94b9d58861949fd3d (diff)
tipc: Enhancements to name table initialization
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>
-rw-r--r--net/tipc/name_table.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index ac7dfdda7973..892373e498e4 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -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;
}