diff mbox

genetlink: optimize ctrl_dumpfamily()

Message ID m2bph5kodr.fsf@ssh.synack.fr
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Samir Bellabes Jan. 8, 2010, 8:10 a.m. UTC
commit f3257ff67aac80d423227eae89281e506fed8cd6
Author: Samir Bellabes <sam@synack.fr>
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 <serue@us.ibm.com>
    
    Signed-off-by: Samir Bellabes <sam@synack.fr>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Jan. 14, 2010, 4:40 a.m. UTC | #1
From: Samir Bellabes <sam@synack.fr>
Date: Fri, 08 Jan 2010 09:10:56 +0100

>     there is a unnecessary test which can be replaced by a good initialization in
>     the 'for' statement
>     
>     Noticed by Serge E. Hallyn <serue@us.ibm.com>
>     
>     Signed-off-by: Samir Bellabes <sam@synack.fr>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c
index d07ecda..a4b6e14 100644
--- a/net/netlink/genetlink.c
+++ b/net/netlink/genetlink.c
@@ -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))