netdev
[Top] [All Lists]

Re: Check connect address in NETLINK

To: "David S. Miller" <davem@xxxxxxxxxx>
Subject: Re: Check connect address in NETLINK
From: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Jul 2004 09:01:47 +1000
Cc: kuznet@xxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040630153606.3493581b.davem@xxxxxxxxxx>
References: <20040629082252.GA26866@xxxxxxxxxxxxx> <20040629084552.GA6202@xxxxxxxxxxxxxxxxxxx> <20040629111433.GA28463@xxxxxxxxxxxxx> <20040629111833.GA22880@xxxxxxxxxxxxxxxxxxx> <20040630112751.GA31160@xxxxxxxxxxxxxxxxxxx> <20040630120045.GA7973@xxxxxxxxxxxxx> <20040630120828.GA31498@xxxxxxxxxxxxxxxxxxx> <20040630121420.GA8183@xxxxxxxxxxxxx> <20040630124050.GA1619@xxxxxxxxxxxxxxxxxxx> <20040630153606.3493581b.davem@xxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040523i
On Wed, Jun 30, 2004 at 03:36:06PM -0700, David S. Miller wrote:
> 
> Why don't you combine the two "ERR_PTR(-ECONNREFUSED)" tests
> into one test like:
> 
>       if ((nlk->pid == 0 && !nlk->data_ready) ||
>           (sock->sk_state == NELTINK_CONNECTED &&
>            nlk->dst_pid != nlk_sk(ssk)->pid)) {
>               sock_put(sock);
>               return ERR_PTR(-ECONNREFUSED);
>       }
> 
> so we don't have two copies of the "sock_put(); return ERR_PTR()"
> thing emitted by the compiler?

Well at least under i386, gcc (3.3.4) is smart enough to merge these
common exit paths.

But yes we could merge them.  What about the following incremental
patch?
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Attachment: p
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>