From: Norbert Kiesel <nkiesel@tbdnetworks.com>
To: linux-kernel@vger.kernel.org
Cc: Norbert Kiesel <nkiesel@defiant>
Subject: [PATCH] Multiple & vs. && and | vs. || bugs in 2.4.20
Date: Sun, 2 Mar 2003 04:14:25 -0800 [thread overview]
Message-ID: <20030302121425.GA27040@defiant> (raw)
Hi,
here are patches for some | vs. || and & vs. && bugs found with
find ${1:-.} -name \*.c | xargs grep -En \
'![a-zA-Z0-9_ ]+(\|[^|]|\&[^&])|([^|]\||[^&]\&) *!'
I also emailed them to the maintainers/authors if I could find them, but
failed for some (e.g. gus_xxx.c).
so long
Norbert
--- linux-2.4.20/drivers/usb/acm.c~ 2002-12-03 00:17:50.000000000 -0800
+++ linux-2.4.20/drivers/usb/acm.c 2003-03-02 03:03:34.000000000 -0800
@@ -240,7 +240,7 @@
if (urb->status)
dbg("nonzero read bulk status received: %d", urb->status);
- if (!urb->status & !acm->throttle) {
+ if (!urb->status && !acm->throttle) {
for (i = 0; i < urb->actual_length && !acm->throttle; i++) {
/* if we insert more than TTY_FLIPBUF_SIZE characters,
* we drop them. */
--- linux-2.4.20/drivers/net/aironet4500_core.c~ 2001-09-30 12:26:06.000000000 -0700
+++ linux-2.4.20/drivers/net/aironet4500_core.c 2003-03-02 03:03:35.000000000 -0800
@@ -2676,10 +2676,8 @@
#endif
//awc_dump_registers(dev);
- if (adhoc & !max_mtu)
- max_mtu= 2250;
- else if (!max_mtu)
- max_mtu= 1500;
+ if (!max_mtu)
+ max_mtu= adhoc ? 2250 : 1500;
priv->sleeping_bap = 1;
--- linux-2.4.20/drivers/video/aty128fb.c~ 2002-12-03 00:17:56.000000000 -0800
+++ linux-2.4.20/drivers/video/aty128fb.c 2003-03-02 03:05:44.000000000 -0800
@@ -2531,7 +2531,7 @@
reg |= LVDS_BL_MOD_EN | LVDS_BLON;
if (on && level > BACKLIGHT_OFF) {
reg |= LVDS_DIGION;
- if (!reg & LVDS_ON) {
+ if ((reg & LVDS_ON) == 0) {
reg &= ~LVDS_BLON;
aty_st_le32(LVDS_GEN_CNTL, reg);
(void)aty_ld_le32(LVDS_GEN_CNTL);
--- linux-2.4.20/drivers/sound/gus_midi.c~ 2001-03-06 19:28:32.000000000 -0800
+++ linux-2.4.20/drivers/sound/gus_midi.c 2003-03-02 03:03:35.000000000 -0800
@@ -183,7 +183,7 @@
qhead++;
}
restore_flags(flags);
- return (qlen > 0) | !(GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY);
+ return (qlen > 0) || !(GUS_MIDI_STATUS() & MIDI_XMIT_EMPTY);
}
#define MIDI_SYNTH_NAME "Gravis Ultrasound Midi"
--- linux-2.4.20/drivers/sound/gus_wave.c~ 2001-09-14 14:40:00.000000000 -0700
+++ linux-2.4.20/drivers/sound/gus_wave.c 2003-03-02 03:03:35.000000000 -0800
@@ -3123,7 +3123,7 @@
gus_initialize();
- if ((gus_mem_size > 0) & !gus_no_wave_dma)
+ if ((gus_mem_size > 0) && !gus_no_wave_dma)
{
hw_config->slots[4] = -1;
if ((gus_devnum = sound_install_audiodrv(AUDIO_DRIVER_VERSION,
--- linux-2.4.20/drivers/i2c/i2c-proc.c~ 2002-03-11 01:07:21.000000000 -0800
+++ linux-2.4.20/drivers/i2c/i2c-proc.c 2003-03-02 03:03:34.000000000 -0800
@@ -729,7 +729,7 @@
||
((address_data->
ignore_range[i] ==
- SENSORS_ANY_I2C_BUS) & !is_isa))
+ SENSORS_ANY_I2C_BUS) && !is_isa))
&& (addr >= address_data->ignore_range[i + 1])
&& (addr <= address_data->ignore_range[i + 2])) {
#ifdef DEBUG
@@ -818,7 +818,7 @@
i += 2) {
if (((adapter_id == address_data->probe[i]) ||
((address_data->
- probe[i] == SENSORS_ANY_I2C_BUS) & !is_isa))
+ probe[i] == SENSORS_ANY_I2C_BUS) && !is_isa))
&& (addr == address_data->probe[i + 1])) {
#ifdef DEBUG
printk
@@ -835,7 +835,7 @@
((adapter_id == address_data->probe_range[i])
||
((address_data->probe_range[i] ==
- SENSORS_ANY_I2C_BUS) & !is_isa))
+ SENSORS_ANY_I2C_BUS) && !is_isa))
&& (addr >= address_data->probe_range[i + 1])
&& (addr <= address_data->probe_range[i + 2])) {
found = 1;
--- linux-2.4.20/drivers/sound/maestro.c~ 2002-08-25 03:12:46.000000000 -0700
+++ linux-2.4.20/drivers/sound/maestro.c 2003-03-02 03:03:34.000000000 -0800
@@ -3359,7 +3359,7 @@
/* check to see if we have a capabilities list in
the config register */
pci_read_config_word(pcidev, PCI_STATUS, &w);
- if(! w & PCI_STATUS_CAP_LIST) return 0;
+ if(!(w & PCI_STATUS_CAP_LIST)) return 0;
/* walk the list, starting at the head. */
pci_read_config_byte(pcidev,PCI_CAPABILITY_LIST,&next);
--- linux-2.4.20/drivers/video/radeonfb.c~ 2002-12-03 00:17:56.000000000 -0800
+++ linux-2.4.20/drivers/video/radeonfb.c 2003-03-02 03:05:42.000000000 -0800
@@ -2778,7 +2778,7 @@
lvds_gen_cntl |= (LVDS_BL_MOD_EN | LVDS_BLON);
if (on && (level > BACKLIGHT_OFF)) {
lvds_gen_cntl |= LVDS_DIGON;
- if (!lvds_gen_cntl & LVDS_ON) {
+ if ((lvds_gen_cntl & LVDS_ON) == 0) {
lvds_gen_cntl &= ~LVDS_BLON;
OUTREG(LVDS_GEN_CNTL, lvds_gen_cntl);
(void)INREG(LVDS_GEN_CNTL);
next reply other threads:[~2003-03-02 12:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-02 12:14 Norbert Kiesel [this message]
2003-03-02 18:05 ` [PATCH] Multiple & vs. && and | vs. || bugs in 2.4.20 Ulrich Drepper
2003-03-02 18:25 ` Roman Zippel
2003-03-02 21:41 ` Werner Almesberger
2003-03-02 22:03 ` Richard Henderson
2003-03-03 2:03 ` Norbert Kiesel
2003-03-03 3:02 ` John Levon
2003-03-06 19:58 ` Pavel Machek
2003-03-07 18:45 ` Norbert Kiesel
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=20030302121425.GA27040@defiant \
--to=nkiesel@tbdnetworks.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nkiesel@defiant \
/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 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.