Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e3e6dcb authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller
Browse files

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: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 20c2c1fd
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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;
}