[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1322500843.26733.2.camel@bwh-desktop>
Date: Mon, 28 Nov 2011 17:20:42 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: Joe Perches <joe@...ches.com>
CC: Eric Dumazet <eric.dumazet@...il.com>,
David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH net-next] tcp: tcp_sendmsg() wrong access to
sk_route_caps
On Mon, 2011-11-28 at 08:54 -0800, Joe Perches wrote:
> On Mon, 2011-11-28 at 17:04 +0100, Eric Dumazet wrote:
> > Le lundi 28 novembre 2011 à 02:46 -0800, Joe Perches a écrit :
> > > On Mon, 2011-11-28 at 11:27 +0100, Eric Dumazet wrote:
> > > > + sg = !!(sk->sk_route_caps & NETIF_F_SG);
> > > As sg is now bool, using !! is unnecessary.
> > > A commit was done recently to remove one.
> > > 3ad9b358e03fd9dbf6705721490c811b666b0fe2
> > Hmm... I find it dangerous and error prone. Obviously not at the time we
> > commit such changes, but later, because a future reader might be fooled.
> > Using !!(expr) is pretty clear about the potential problem, and
> > generates no extra code if a bool is used for the target.
>
> Though I don't think
> bool = expr;
> is particularly error prone,
> spatch shows 58 uses of
> bool = !!expr;
> in net-next drivers/net.
>
> It might be useful to standardize on either the
> implicit or explicit !! style.
>
> I think !! is an intentional and sensible style
> and should be the preferred use.
I see it as a workaround for the historical lack of a real bool type in
C.
> Perhaps a checkpatch warning should be issued
> when the implicit cast is used.
checkpatch can't do type-checking; maybe you mean sparse.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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