[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ysl4TPkTNW+6JPj4@eidolon.nox.tf>
Date: Sat, 9 Jul 2022 14:45:00 +0200
From: David Lamparter <equinox@...c24.net>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Nikolay Aleksandrov <razor@...ckwall.org>,
David Ahern <dsahern@...nel.org>
Subject: Re: [PATCH net-next v5] net: ip6mr: add RTM_GETROUTE netlink op
On Fri, Jul 08, 2022 at 08:29:51PM -0700, Jakub Kicinski wrote:
> Few more nit picks, sorry..
Thanks for the feedback! [opens editor]
> On Thu, 7 Jul 2022 11:33:36 +0200 David Lamparter wrote:
[...]
> > + err = ip6mr_rtm_valid_getroute_req(in_skb, nlh, tb, extack);
> > + if (err < 0)
> > + goto errout;
>
> Can we:
>
> return err;
>
> ? I don't know where the preference for jumping to the return statement
> came from, old compilers? someone's "gut feeling"?
If I were forced to find a justification, I'd say having a central
sequence of exit helps avoiding mistakes when some other resource
acquisition is added later. Easy to add a cleanup call to an existing
cleanup block - easy to overlook a "return err;" that needs to be
changed to "goto errout;".
But I have absolutely no stake in this at all, I'll happily edit it to
whatever the consensus is. This is just what the IPv4 code looks like
after being adapted for IPv6.
> > +errout:
> > + return err;
[...]
> > +
> > +errout_free:
> > + kfree_skb(skb);
> > + goto errout;
>
> and no need to do the funky backwards jump here either, IMO
"funky" is a nice description.
-equi/David
Powered by blists - more mailing lists