[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1322499255.2024.22.camel@Joe-Laptop>
Date: Mon, 28 Nov 2011 08:54:15 -0800
From: Joe Perches <joe@...ches.com>
To: Eric Dumazet <eric.dumazet@...il.com>
Cc: David Miller <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Michał Mirosław <mirq-linux@...e.qmqm.pl>,
Ben Hutchings <bhutchings@...arflare.com>,
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 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.
Perhaps a checkpatch warning should be issued
when the implicit cast is used.
--
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