From: Ben Hutchings <bhutchings@solarflare.com>
To: Joe Perches <joe@perches.com>
Cc: "Eric Dumazet" <eric.dumazet@gmail.com>,
"David Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH net-next] tcp: tcp_sendmsg() wrong access to sk_route_caps
Date: Mon, 28 Nov 2011 17:20:42 +0000 [thread overview]
Message-ID: <1322500843.26733.2.camel@bwh-desktop> (raw)
In-Reply-To: <1322499255.2024.22.camel@Joe-Laptop>
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.
next prev parent reply other threads:[~2011-11-28 17:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 10:27 [PATCH net-next] tcp: tcp_sendmsg() wrong access to sk_route_caps Eric Dumazet
2011-11-28 10:46 ` Joe Perches
2011-11-28 16:04 ` Eric Dumazet
2011-11-28 16:53 ` David Laight
2011-11-28 16:54 ` Joe Perches
2011-11-28 17:20 ` Ben Hutchings [this message]
2011-11-28 17:32 ` Joe Perches
2011-11-28 23:58 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1322500843.26733.2.camel@bwh-desktop \
--to=bhutchings@solarflare.com \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=joe@perches.com \
--cc=mirq-linux@rere.qmqm.pl \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.