From patchwork Fri Jan 8 08:10:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samir Bellabes X-Patchwork-Id: 42502 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2210DB7BF3 for ; Fri, 8 Jan 2010 19:11:03 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753328Ab0AHIK6 (ORCPT ); Fri, 8 Jan 2010 03:10:58 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753288Ab0AHIK6 (ORCPT ); Fri, 8 Jan 2010 03:10:58 -0500 Received: from bob75-7-88-160-5-175.fbx.proxad.net ([88.160.5.175]:45716 "EHLO cerbere.dyndns.info" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753302Ab0AHIK5 (ORCPT ); Fri, 8 Jan 2010 03:10:57 -0500 Received: by cerbere.dyndns.info (Postfix, from userid 501) id 7622683D7; Fri, 8 Jan 2010 09:10:56 +0100 (CET) From: Samir Bellabes To: "David S. Miller" Cc: Thomas Graf , Johannes Berg , jamal , netdev@vger.kernel.org Subject: [PATCH] genetlink: optimize ctrl_dumpfamily() Date: Fri, 08 Jan 2010 09:10:56 +0100 Message-ID: User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org commit f3257ff67aac80d423227eae89281e506fed8cd6 Author: Samir Bellabes 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 Signed-off-by: Samir Bellabes --- 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 --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))