Skip to contentSkip to conversation

genetlink: optimize ctrl_dumpfamily()

PATCH Applied Samir Bellabes 2 participants 2 messages Jan 8, 2010 – Jan 14, 2010

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

PATCH 1/1 genetlink: optimize ctrl_dumpfamily()

commit f3257ff67aac80d423227eae89281e506fed8cd6

Author: Samir Bellabes <[email protected]>
Date:   Fri Jan 8 08:44:41 2010 +0100

genetlink: optimize ctrl_dumpfamily()

there is a unnecessary test which can be replaced by a good initialization in the 'for' statement

Noticed by Serge E. Hallyn <[email protected]>

net/netlink/genetlink.c +1 -3
index d07ecda..a4b6e14 100644
@@ -681,9 +681,7 @@ static int ctrl_dumpfamily(struct sk_buff *skb, struct netlink_callback *cb)
 	int chains_to_skip = cb->args[0];
 	int fams_to_skip = cb->args[1];
 
-	for (i = 0; i < GENL_FAM_TAB_SIZE; i++) {
-		if (i < chains_to_skip)
-			continue;
+	for (i = chains_to_skip; i < GENL_FAM_TAB_SIZE; i++) {
 		n = 0;
 		list_for_each_entry(rt, genl_family_chain(i), family_list) {
 			if (!rt->netnsok && !net_eq(net, &init_net))