netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
	"Ben Hutchings" <bhutchings@solarflare.com>,
	"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 08:54:15 -0800	[thread overview]
Message-ID: <1322499255.2024.22.camel@Joe-Laptop> (raw)
In-Reply-To: <1322496298.2292.76.camel@edumazet-HP-Compaq-6005-Pro-SFF-PC>

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.

  parent reply	other threads:[~2011-11-28 16:54 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 [this message]
2011-11-28 17:20       ` Ben Hutchings
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=1322499255.2024.22.camel@Joe-Laptop \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).