[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080911.201458.162553481.davem@davemloft.net>
Date: Thu, 11 Sep 2008 20:14:58 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: shanwei@...fujitsu.com
Cc: brian.haley@...com, netdev@...r.kernel.org
Subject: Re: [PATCH RESEND] ipv6: return with appropriate error code when
sending RH0 using setsockopt()
From: Shan Wei <shanwei@...fujitsu.com>
Date: Thu, 04 Sep 2008 11:44:10 +0800
> Brian Haley 写道:
> > Shan Wei wrote:
> >> diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
> >> index 4e5eac3..7a58597 100644
> >> --- a/net/ipv6/ipv6_sockglue.c
> >> +++ b/net/ipv6/ipv6_sockglue.c
> >> @@ -353,9 +353,10 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
> >> goto e_inval;
> >>
> >> /* hop-by-hop / destination options are privileged option */
> >> - retv = -EPERM;
> >> - if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW))
> >> + if (optname != IPV6_RTHDR && !capable(CAP_NET_RAW)) {
> >> + retv = -EPERM;
> >> break;
> >> + }
> >
> > I'm not sure you need this since it doesn't actually change anything,
> > setting the error before the check just seems like the style in this
> > function. It will get set to -EINVAL below...
> >
> For uncommon expection, if the check is true, we set the error.
> it will reduce the number of setting retv value.
Do you have some emotional attachment to this change? :-/
The compiler optimizer will make the transformation you claim is
now possible, all by itself, if it is deemed more optimal.
Never make any claims about how many times something will or will not
happen in the compiled output without consulting and providing
examples of the resulting assembler. Otherwise you are just guessing.
This is just a pointless change, and as Brian said it disagrees with
the way this construct is made in the rest of this function. So
please take it out of your patch.
Powered by blists - more mailing lists