From: Julia Lawall <julia.lawall@lip6.fr>
To: Varsha Rao <rvarsha016@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
linux-kernel@vger.kernel.org, cocci <cocci@systeme.lip6.fr>,
linux-crypto@vger.kernel.org, Joe Perches <joe@perches.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] crypto: cavium: zip: Remove unnecessary parentheses
Date: Sat, 31 Mar 2018 08:18:01 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.20.1803310817420.2373@hadrien> (raw)
In-Reply-To: <CAAFX7JTfWdaGra+kWBJt-GXVVO601K03qWnExFKFD_9vxS-03g@mail.gmail.com>
On Thu, 29 Mar 2018, 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.
>
> --- a/drivers/crypto/cavium/zip/zip_main.c
> +++ b/drivers/crypto/cavium/zip/zip_main.c
> @@ -99,7 +99,7 @@ static struct zip_device *zip_alloc_devi
> */
> struct zip_device *zip_get_device(int node)
> {
> - if ((node < MAX_ZIP_DEVICES) && (node >= 0))
> + if (node < MAX_ZIP_DEVICES && node >= 0)
Why is it a false positive?
julia
> return zip_dev[node];
>
> zip_err("ZIP device not found for node id %d\n", node);
>
> I checked if there was any case of extra parentheses around relational
> operators left, but there were none. Hence, in the script I included
> only the cases present in the result.
>
> Thanks,
> Varsha
> _______________________________________________
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>
next prev parent reply other threads:[~2018-03-31 6:18 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
2018-03-31 6:18 ` Julia Lawall [this message]
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.1803310817420.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