Skip to content

Commit

Permalink
genetlink: optimize ctrl_dumpfamily()
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Samir Bellabes authored and davem330 committed Jan 14, 2010
1 parent 37fce43 commit e1d5a01
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/netlink/genetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit e1d5a01

Please sign in to comment.