From: Julia Lawall <julia.lawall@lip6.fr>
To: Joe Perches <joe@perches.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Varsha Rao <rvarsha016@gmail.com>,
linux-kernel@vger.kernel.org, cocci <cocci@systeme.lip6.fr>,
linux-crypto@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] crypto: cavium: zip: Remove unnecessary parentheses
Date: Sat, 31 Mar 2018 08:17:34 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1803310816360.2373@hadrien> (raw)
In-Reply-To: <1522441039.2210.50.camel@perches.com>
On Fri, 30 Mar 2018, Joe Perches wrote:
> On Thu, 2018-03-29 at 21:03 +0530, Varsha Rao wrote:
> > On Wed, Mar 28, 2018 at 11:41 PM, Joe Perches wrote:
> > >
> > > On Wed, 2018-03-28 at 23:27, Varsha Rao wrote:
> > > > This patch fixes the clang warning of extraneous parentheses, with the
> > > > following coccinelle script.
> > > >
> > > > @@
> > > > identifier i;
> > > > constant c;
> > > > @@
> > > > (
> > > > -((i == c))
> > > > +i == c
> > > > >
> > > >
> > > > -((i <= c))
> > > > +i <= c
> > >
> > > Why just the "==" and "<=" cases?
> > > Why not "<", ">" and ">=" too?
> > >
> > > Why not expression instead of constant?
> >
> > Initially I had the other cases too and used expression instead of
> > constant. But the results included only "==" and "<=" cases with
> > constant. Along with one false positive case.
> hmm
> Perhaps you should use something like this?
> @@
> identifier i;
> constant c;
> @@
>
> -(
> \(i == c\|i <= c\|i < c\|i >= c\|i > c\)
> -)
This is not safe with respect to !. The following seems to address this
problem:
@@
identifier i;
constant c;
expression e;
@@
(
!(e)
|
-(
\(i == c\|i <= c\|i < c\|i >= c\|i > c\)
-)
)
julia
next prev parent reply other threads:[~2018-03-31 6:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 17:57 [PATCH] crypto: cavium: zip: Remove unnecessary parentheses Varsha Rao
2018-03-28 18:11 ` Joe Perches
2018-03-29 15:33 ` Varsha Rao
2018-03-30 20:17 ` Joe Perches
2018-03-31 6:17 ` Julia Lawall [this message]
2018-03-31 6:18 ` Julia Lawall
2018-03-31 8:48 ` [Cocci] " Varsha Rao
2018-03-31 8:55 ` Julia Lawall
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=alpine.DEB.2.20.1803310816360.2373@hadrien \
--to=julia.lawall@lip6.fr \
--cc=cocci@systeme.lip6.fr \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=joe@perches.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rvarsha016@gmail.com \
/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