Skip to contentSkip to conversation

: Enhancements to name table initialization

PATCH Applied Allan Stephens 2 participants 2 messages May 12, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : 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.

---
 net/tipc/name_table.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
net/tipc/name_table.c +2 -5
index ac7dfdd..892373e 100644
@@ -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;
 }
 
Signature · 1 line
1.5.3.2
maintainer Applied
#1 lore raw

From: Allan Stephens <[email protected]>
Date: Mon, 12 May 2008 16:33:03 -0400

Quoted 5 lines

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.

Applied.