[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140326231342.GA22381@macbook.localnet>
Date: Wed, 26 Mar 2014 23:13:42 +0000
From: Patrick McHardy <kaber@...sh.net>
To: Richard Guy Briggs <rgb@...hat.com>
Cc: linux-audit@...hat.com, linux-kernel@...r.kernel.org,
netfilter-devel@...r.kernel.org, netdev@...r.kernel.org,
eparis@...hat.com, sgrubb@...hat.com, hadi@...atatu.com,
davem@...emloft.net
Subject: Re: [PATCH][v6] netlink: have netlink per-protocol bind function
return an error code.
On Tue, Mar 25, 2014 at 08:50:56AM -0400, Richard Guy Briggs wrote:
> + if (nlk->netlink_bind && nladdr->nl_groups) {
> + int i;
> +
> + for (i = 0; i < nlk->ngroups; i++)
> + if (test_bit(i, (long unsigned int *)&nladdr->nl_groups)) {
> + err = nlk->netlink_bind(i);
> + if (err) {
> + int undo;
> + if (!nlk->portid)
> + netlink_remove(sk);
> + for (undo = 0; undo < i; undo++)
> + if (nlk->netlink_unbind)
> + nlk->netlink_unbind(undo);
Do we really need 7 levels of indentation? You could save at least
one by using
if (!test_bit(...)
continue;
...
Or maybe simply move this to a helper function.
> + return err;
> + }
> + }
> + }
> +
> netlink_table_grab();
> netlink_update_subscriptions(sk, nlk->subscriptions +
> hweight32(nladdr->nl_groups) -
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists