* [PATCH] gx-suspmod: fix "&& 0xff" typo
@ 2006-11-08 22:04 Alexey Dobriyan
2006-11-08 22:10 ` Randy Dunlap
2006-11-08 22:11 ` Dave Jones
0 siblings, 2 replies; 8+ messages in thread
From: Alexey Dobriyan @ 2006-11-08 22:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dave Jones, linux-kernel
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
@@ -473,7 +473,7 @@ static int __init cpufreq_gx_init(void)
pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev);
- params->pci_rev = class_rev && 0xff;
+ params->pci_rev = class_rev & 0xff;
if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) {
kfree(params);
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
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:11 ` Dave Jones
1 sibling, 1 reply; 8+ messages in thread
From: Randy Dunlap @ 2006-11-08 22:10 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Andrew Morton, Dave Jones, linux-kernel
On Thu, 9 Nov 2006 01:04:35 +0300 Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> @@ -473,7 +473,7 @@ static int __init cpufreq_gx_init(void)
> pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
> pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
> pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev);
> - params->pci_rev = class_rev && 0xff;
> + params->pci_rev = class_rev & 0xff;
Hi,
any kind of automated detection on that one?
thanks,
---
~Randy
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:10 ` Randy Dunlap
@ 2006-11-08 22:16 ` Dave Jones
2006-11-08 22:20 ` Alexey Dobriyan
0 siblings, 1 reply; 8+ messages in thread
From: Dave Jones @ 2006-11-08 22:16 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Alexey Dobriyan, Andrew Morton, Dave Jones, linux-kernel
On Wed, Nov 08, 2006 at 02:10:07PM -0800, Randy Dunlap wrote:
> On Thu, 9 Nov 2006 01:04:35 +0300 Alexey Dobriyan wrote:
>
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> > ---
> >
> > arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> > +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> > @@ -473,7 +473,7 @@ static int __init cpufreq_gx_init(void)
> > pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
> > pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
> > pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev);
> > - 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.
Dave
--
http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:16 ` Dave Jones
@ 2006-11-08 22:20 ` Alexey Dobriyan
2006-11-08 22:50 ` Dave Jones
2006-11-10 20:16 ` Horst H. von Brand
0 siblings, 2 replies; 8+ messages in thread
From: Alexey Dobriyan @ 2006-11-08 22:20 UTC (permalink / raw)
To: Dave Jones, Randy Dunlap, Andrew Morton, Dave Jones, linux-kernel
> > > - 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 .
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:20 ` Alexey Dobriyan
@ 2006-11-08 22:50 ` Dave Jones
2006-11-09 4:24 ` Willy Tarreau
2006-11-10 20:16 ` Horst H. von Brand
1 sibling, 1 reply; 8+ messages in thread
From: Dave Jones @ 2006-11-08 22:50 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Randy Dunlap, Andrew Morton, Dave Jones, linux-kernel
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);
Dave
--
http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:50 ` Dave Jones
@ 2006-11-09 4:24 ` Willy Tarreau
0 siblings, 0 replies; 8+ messages in thread
From: Willy Tarreau @ 2006-11-09 4:24 UTC (permalink / raw)
To: Dave Jones, Alexey Dobriyan, Randy Dunlap, Andrew Morton,
Dave Jones, linux-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:20 ` Alexey Dobriyan
2006-11-08 22:50 ` Dave Jones
@ 2006-11-10 20:16 ` Horst H. von Brand
1 sibling, 0 replies; 8+ messages in thread
From: Horst H. von Brand @ 2006-11-10 20:16 UTC (permalink / raw)
To: Alexey Dobriyan
Cc: Dave Jones, Randy Dunlap, Andrew Morton, Dave Jones, linux-kernel
Alexey Dobriyan <adobriyan@gmail.com> 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 .
Hum... could also be, e.g., "&& 1 << 3", or "&& SOME_FUNKY_CONSTANT"...
grep -r '&&[ ]*[0-9A-Z]'
but that gives lots of noise... need to refine (or just eyeball the
output). OK, will check.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 2654431
Universidad Tecnica Federico Santa Maria +56 32 2654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 2797513
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] gx-suspmod: fix "&& 0xff" typo
2006-11-08 22:04 [PATCH] gx-suspmod: fix "&& 0xff" typo Alexey Dobriyan
2006-11-08 22:10 ` Randy Dunlap
@ 2006-11-08 22:11 ` Dave Jones
1 sibling, 0 replies; 8+ messages in thread
From: Dave Jones @ 2006-11-08 22:11 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Andrew Morton, linux-kernel
On Thu, Nov 09, 2006 at 01:04:35AM +0300, Alexey Dobriyan wrote:
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
> ---
>
> arch/i386/kernel/cpu/cpufreq/gx-suspmod.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> +++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
> @@ -473,7 +473,7 @@ static int __init cpufreq_gx_init(void)
> pci_read_config_byte(params->cs55x0, PCI_MODON, &(params->on_duration));
> pci_read_config_byte(params->cs55x0, PCI_MODOFF, &(params->off_duration));
> pci_read_config_dword(params->cs55x0, PCI_CLASS_REVISION, &class_rev);
> - params->pci_rev = class_rev && 0xff;
> + params->pci_rev = class_rev & 0xff;
>
> if ((ret = cpufreq_register_driver(&gx_suspmod_driver))) {
> kfree(params);
Ouch, good catch. applied.
Dave
--
http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-11-11 3:44 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2006-11-10 20:16 ` Horst H. von Brand
2006-11-08 22:11 ` Dave Jones
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.