lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180208140435.drxepn4badqj76sr@mwanda>
Date:   Thu, 8 Feb 2018 17:04:35 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Julia Lawall <julia.lawall@...6.fr>
Cc:     Masahiro Yamada <yamada.masahiro@...ionext.com>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        kernel-janitors@...r.kernel.org,
        Gilles Muller <Gilles.Muller@...6.fr>,
        Nicolas Palix <nicolas.palix@...g.fr>,
        Michal Marek <michal.lkml@...kovi.net>, cocci@...teme.lip6.fr,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] scripts/coccinelle/misc/shift.cocci: detect < or > that
 should be a shift

On Thu, Feb 08, 2018 at 02:58:56PM +0100, Julia Lawall wrote:
> 
> 
> On Thu, 8 Feb 2018, Dan Carpenter wrote:
> 
> > On Thu, Feb 08, 2018 at 01:53:54PM +0100, Julia Lawall wrote:
> > > This checks for a comparison using < or > between two constants,
> > > considering both explicit constants (1, 2, etc) and macros defined
> > > with #define.  False positives are possible in the latter case, when
> > > a macro may have multiple possible definitions and it is indeed
> > > necessary to check the value.  There are currently two such false
> > > positives, in drivers/net/ethernet/chelsio/cxgb3/sge.c:
> > >
> > >        q->fl[0].use_pages = FL0_PG_CHUNK_SIZE > 0;
> > >        q->fl[1].use_pages = FL1_PG_CHUNK_SIZE > 0;
> > >
> >
> > We could eliminate both these false postives by ignoring >> vs >.  Did
> > searching for > actually find any bugs?  I think you were right that
> > right shifting a constant is way less common than left shifting and I
> > have some smatch scripts where I ignore right shifting bugs.
> >
> > On the other hand, two false positives are not a big deal.
> 
> I found no bugs with > at the moment.  I figured that the person could
> have just as easily written 0 < FL0_PG_CHUNK_SIZE, so it was not worth
                              ^^^^^^^^^^^^^^^^^^^^^
That's a Yoda speak type condition though so it's less common.

Unrelated, but I fixed a Yoda condition today where the test was
reversed so I feel like Yoda conditions are more likely to be buggy
(because they are hard to read).

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ