diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2008-05-12 18:41:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-05-12 18:41:53 -0400 |
commit | 4e3e6dcb43c3669a8817cb3d0f920f91661afd98 (patch) | |
tree | 84b83811790add972a3a47ee378afd44b011a47d /net/tipc | |
parent | 20c2c1fd6c842caf70dcb1d94b9d58861949fd3d (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>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/name_table.c | 7 |
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) | |||
1050 | 1050 | ||
1051 | int tipc_nametbl_init(void) | 1051 | int tipc_nametbl_init(void) |
1052 | { | 1052 | { |
1053 | int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; | 1053 | table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head), |
1054 | 1054 | GFP_ATOMIC); | |
1055 | table.types = kzalloc(array_size, GFP_ATOMIC); | ||
1056 | if (!table.types) | 1055 | if (!table.types) |
1057 | return -ENOMEM; | 1056 | return -ENOMEM; |
1058 | 1057 | ||
1059 | write_lock_bh(&tipc_nametbl_lock); | ||
1060 | table.local_publ_count = 0; | 1058 | table.local_publ_count = 0; |
1061 | write_unlock_bh(&tipc_nametbl_lock); | ||
1062 | return 0; | 1059 | return 0; |
1063 | } | 1060 | } |
1064 | 1061 | ||