The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Dave Jones <davej@redhat.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Andrew Morton <akpm@osdl.org>,
	Dave Jones <davej@codemonkey.org.uk>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
Date: Thu, 9 Nov 2006 05:24:34 +0100	[thread overview]
Message-ID: <20061109042433.GB589@1wt.eu> (raw)
In-Reply-To: <20061108225007.GI3309@redhat.com>

On Wed, Nov 08, 2006 at 05:50:07PM -0500, Dave Jones wrote:
> On Thu, Nov 09, 2006 at 01:20:46AM +0300, Alexey Dobriyan wrote:
>  > >  > > -	params->pci_rev = class_rev && 0xff;
>  > >  > > +	params->pci_rev = class_rev & 0xff;
>  > >  >
>  > >  > Hi,
>  > >  > any kind of automated detection on that one?
>  > >
>  > > grep -r "&& 0x" .  seems to be pretty effective modulo
>  > > some false-positives.
>  > 
>  > Obligatory nit-picking:
>  > 
>  > 	grep '&&[ 	]*0[xX][fF]' -r .
> 
> That misses some cases. Like..
> 
> drivers/char/ipmi/ipmi_msghandler.c:                    bmc->id.device_revision && 0x80 >> 7);
> drivers/char/ipmi/ipmi_msghandler.c:                    bmc->id.device_revision && 0x0F);

Interesting grep. I found that cmpci, gdth, net1080 and nv_setup are affected
too in my rather old 2.6.18-rc4 tree. More importantly, I found a few ones in
2.4 that I will have to address.

Thanks guys for the good idea. Once again, it shows that pure code review
would considerably help finding such bugs.

Cheers,
Willy


  reply	other threads:[~2006-11-09  4:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-08 22:04 [PATCH] gx-suspmod: fix "&& 0xff" typo Alexey Dobriyan
2006-11-08 22:10 ` Randy Dunlap
2006-11-08 22:16   ` Dave Jones
2006-11-08 22:20     ` Alexey Dobriyan
2006-11-08 22:50       ` Dave Jones
2006-11-09  4:24         ` Willy Tarreau [this message]
2006-11-10 20:16       ` Horst H. von Brand
2006-11-08 22:11 ` Dave Jones

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=20061109042433.GB589@1wt.eu \
    --to=w@1wt.eu \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=davej@codemonkey.org.uk \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.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