From: Samir Bellabes <sam@synack.fr>
To: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Graf <tgraf@suug.ch>,
Johannes Berg <johannes@sipsolutions.net>,
jamal <hadi@cyberus.ca>,
netdev@vger.kernel.org
Subject: [PATCH] genetlink: optimize ctrl_dumpfamily()
Date: Fri, 08 Jan 2010 09:10:56 +0100 [thread overview]
Message-ID: <m2bph5kodr.fsf@ssh.synack.fr> (raw)
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>
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))
next reply other threads:[~2010-01-08 8:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-08 8:10 Samir Bellabes [this message]
2010-01-14 4:40 ` [PATCH] genetlink: optimize ctrl_dumpfamily() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2bph5kodr.fsf@ssh.synack.fr \
--to=sam@synack.fr \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=johannes@sipsolutions.net \
--cc=netdev@vger.kernel.org \
--cc=tgraf@suug.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).