On Mon, Oct 08, 2007 at 10:05:40AM -0700, [email protected] wrote:
> --- a/mm/fremap.c~fix-vm_can_nonlinear-check-in-sys_remap_file_pages
> +++ a/mm/fremap.c
> @@ -160,7 +160,7 @@ asmlinkage long sys_remap_file_pages(uns
> if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
> goto out;
>
> - if (!vma->vm_flags & VM_CAN_NONLINEAR)
> + if (!(vma->vm_flags & VM_CAN_NONLINEAR))
Ick.
[PATCH] typo time?
Signed-off-by: Alexey Dobriyan <[email protected]>
---
drivers/block/paride/pt.c | 2 -
drivers/block/pktcdvd.c | 4 +--
drivers/isdn/act2000/module.c | 22 ++++++++---------
drivers/isdn/i4l/isdn_ttyfax.c | 2 -
drivers/isdn/icn/icn.c | 22 ++++++++---------
drivers/isdn/isdnloop/isdnloop.c | 16 ++++++------
drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 2 -
drivers/net/wireless/airo.c | 2 -
drivers/net/wireless/atmel.c | 2 -
drivers/net/wireless/prism54/isl_ioctl.c | 4 +--
drivers/net/wireless/zd1211rw/zd_rf_uw2453.c | 2 -
drivers/video/i810/i810_main.c | 2 -
drivers/video/sis/sis_main.c | 2 -
fs/ocfs2/alloc.c | 2 -
net/ieee80211/ieee80211_wx.c | 2 -
15 files changed, 44 insertions(+), 44 deletions(-)
--- a/drivers/block/paride/pt.c
+++ b/drivers/block/paride/pt.c
@@ -660,7 +660,7 @@ static int pt_open(struct inode *inode, struct file *file)
pt_identify(tape);
err = -ENODEV;
- if (!tape->flags & PT_MEDIA)
+ if (!(tape->flags & PT_MEDIA))
goto out;
err = -EROFS;
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2204,11 +2204,11 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed)
return ret;
}
- if (!buf[6] & 0x40) {
+ if (!(buf[6] & 0x40)) {
printk(DRIVER_NAME": Disc type is not CD-RW\n");
return 1;
}
- if (!buf[6] & 0x4) {
+ if (!(buf[6] & 0x4)) {
printk(DRIVER_NAME": A1 values on media are not valid, maybe not CDRW?\n");
return 1;
}
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -310,7 +310,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
break;
case ISDN_CMD_DIAL:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
@@ -339,7 +339,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
return ret;
case ISDN_CMD_ACCEPTD:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
@@ -347,11 +347,11 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_select_b2_protocol_req(card, chan);
return 0;
case ISDN_CMD_ACCEPTB:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
return 0;
case ISDN_CMD_HANGUP:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
@@ -366,7 +366,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
}
return 0;
case ISDN_CMD_SETEAZ:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
@@ -386,7 +386,7 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_listen_req(card);
return 0;
case ISDN_CMD_CLREAZ:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
@@ -394,14 +394,14 @@ act2000_command(act2000_card * card, isdn_ctrl * c)
actcapi_listen_req(card);
return 0;
case ISDN_CMD_SETL2:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if (!(chan = find_channel(card, c->arg & 0x0f)))
break;
chan->l2prot = (c->arg >> 8);
return 0;
case ISDN_CMD_SETL3:
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
if ((c->arg >> 8) != ISDN_PROTO_L3_TRANS) {
printk(KERN_WARNING "L3 protocol unknown\n");
@@ -524,7 +524,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int channel)
act2000_card *card = act2000_findcard(id);
if (card) {
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
return (len);
}
@@ -539,7 +539,7 @@ if_readstatus(u_char __user * buf, int len, int id, int channel)
act2000_card *card = act2000_findcard(id);
if (card) {
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
return (act2000_readstatus(buf, len, card));
}
@@ -554,7 +554,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb)
act2000_card *card = act2000_findcard(id);
if (card) {
- if (!card->flags & ACT2000_FLAGS_RUNNING)
+ if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
return (act2000_sendbuf(card, channel, ack, skb));
}
--- a/drivers/isdn/i4l/isdn_ttyfax.c
+++ b/drivers/isdn/i4l/isdn_ttyfax.c
@@ -834,7 +834,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
char *rp = &f->resolution;
p[0] += 2;
- if (!info->faxonline & 1) /* not outgoing connection */
+ if (!(info->faxonline & 1)) /* not outgoing connection */
PARSE_ERROR1;
for (i = 0; (((*p[0] >= '0') && (*p[0] <= '9')) || (*p[0] == ',')) && (i < 4); i++) {
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -1302,7 +1302,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_DIAL:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1328,7 +1328,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_ACCEPTD:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ICN_BCH) {
a = c->arg + 1;
@@ -1348,7 +1348,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_ACCEPTB:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ICN_BCH) {
a = c->arg + 1;
@@ -1366,7 +1366,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_HANGUP:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ICN_BCH) {
a = c->arg + 1;
@@ -1375,7 +1375,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_SETEAZ:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1391,7 +1391,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_CLREAZ:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1405,7 +1405,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_SETL2:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
if ((c->arg & 255) < ICN_BCH) {
a = c->arg;
@@ -1424,7 +1424,7 @@ icn_command(isdn_ctrl * c, icn_card * card)
}
break;
case ISDN_CMD_SETL3:
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
return 0;
default:
@@ -1471,7 +1471,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int channel)
icn_card *card = icn_findcard(id);
if (card) {
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
return (icn_writecmd(buf, len, 1, card));
}
@@ -1486,7 +1486,7 @@ if_readstatus(u_char __user *buf, int len, int id, int channel)
icn_card *card = icn_findcard(id);
if (card) {
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
return (icn_readstatus(buf, len, card));
}
@@ -1501,7 +1501,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb)
icn_card *card = icn_findcard(id);
if (card) {
- if (!card->flags & ICN_FLAGS_RUNNING)
+ if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
return (icn_sendbuf(channel, ack, skb, card));
}
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1184,7 +1184,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_DIAL:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1210,7 +1210,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_ACCEPTD:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ISDNLOOP_BCH) {
a = c->arg + 1;
@@ -1238,7 +1238,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_ACCEPTB:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ISDNLOOP_BCH) {
a = c->arg + 1;
@@ -1264,7 +1264,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
i = isdnloop_writecmd(cbuf, strlen(cbuf), 0, card);
break;
case ISDN_CMD_HANGUP:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (c->arg < ISDNLOOP_BCH) {
a = c->arg + 1;
@@ -1273,7 +1273,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_SETEAZ:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1303,7 +1303,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_SETL2:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if ((c->arg & 255) < ISDNLOOP_BCH) {
a = c->arg;
@@ -1395,7 +1395,7 @@ if_readstatus(u_char __user *buf, int len, int id, int channel)
isdnloop_card *card = isdnloop_findcard(id);
if (card) {
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
return (isdnloop_readstatus(buf, len, card));
}
@@ -1410,7 +1410,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff *skb)
isdnloop_card *card = isdnloop_findcard(id);
if (card) {
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
/* ack request stored in skb scratch area */
*(skb->head) = ack;
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -410,7 +410,7 @@ static int parse_mtoken(const char *ptr,unsigned int len,
int msk;
*valptr = 0;
for (idx = 0, msk = 1; valid_bits; idx++, msk <<= 1) {
- if (!msk & valid_bits) continue;
+ if (!(msk & valid_bits)) continue;
valid_bits &= ~msk;
if (!names[idx]) continue;
slen = strlen(names[idx]);
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -6417,7 +6417,7 @@ static int airo_set_encode(struct net_device *dev,
set_wep_key(local, index, NULL, 0, perm, 1);
} else
/* Don't complain if only change the mode */
- if(!dwrq->flags & IW_ENCODE_MODE) {
+ if(!(dwrq->flags & IW_ENCODE_MODE)) {
return -EINVAL;
}
}
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1761,7 +1761,7 @@ static int atmel_set_encode(struct net_device *dev,
priv->default_key = index;
} else
/* Don't complain if only change the mode */
- if (!dwrq->flags & IW_ENCODE_MODE) {
+ if (!(dwrq->flags & IW_ENCODE_MODE)) {
return -EINVAL;
}
}
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -1118,7 +1118,7 @@ prism54_set_encode(struct net_device *ndev, struct iw_request_info *info,
mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
&index);
} else {
- if (!dwrq->flags & IW_ENCODE_MODE) {
+ if (!(dwrq->flags & IW_ENCODE_MODE)) {
/* we cannot do anything. Complain. */
return -EINVAL;
}
@@ -2630,7 +2630,7 @@ prism2_ioctl_set_encryption(struct net_device *dev,
mgt_set_request(priv, DOT11_OID_DEFKEYID, 0,
&index);
} else {
- if (!param->u.crypt.flags & IW_ENCODE_MODE) {
+ if (!(param->u.crypt.flags & IW_ENCODE_MODE)) {
/* we cannot do anything. Complain. */
return -EINVAL;
}
--- a/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
+++ b/drivers/net/wireless/zd1211rw/zd_rf_uw2453.c
@@ -403,7 +403,7 @@ static int uw2453_init_hw(struct zd_rf *rf)
if (r)
return r;
- if (!intr_status & 0xf) {
+ if (!(intr_status & 0xf)) {
dev_dbg_f(zd_chip_dev(chip),
"PLL locked on configuration %d\n", i);
found_config = i;
--- a/drivers/video/i810/i810_main.c
+++ b/drivers/video/i810/i810_main.c
@@ -1476,7 +1476,7 @@ static int i810fb_cursor(struct fb_info *info, struct fb_cursor *cursor)
struct i810fb_par *par = info->par;
u8 __iomem *mmio = par->mmio_start_virtual;
- if (!par->dev_flags & LOCKUP)
+ if (!(par->dev_flags & LOCKUP))
return -ENXIO;
if (cursor->image.width > 64 || cursor->image.height > 64)
--- a/drivers/video/sis/sis_main.c
+++ b/drivers/video/sis/sis_main.c
@@ -427,7 +427,7 @@ sisfb_interpret_edid(struct sisfb_monitor *monitor, u8 *buffer)
monitor->feature = buffer[0x18];
- if(!buffer[0x14] & 0x80) {
+ if(!(buffer[0x14] & 0x80)) {
if(!(buffer[0x14] & 0x08)) {
printk(KERN_INFO
"sisfb: WARNING: Monitor does not support separate syncs\n");
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -3961,7 +3961,7 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
struct ocfs2_merge_ctxt ctxt;
struct ocfs2_extent_list *rightmost_el;
- if (!rec->e_flags & OCFS2_EXT_UNWRITTEN) {
+ if (!(rec->e_flags & OCFS2_EXT_UNWRITTEN)) {
ret = -EIO;
mlog_errno(ret);
goto out;
--- a/net/ieee80211/ieee80211_wx.c
+++ b/net/ieee80211/ieee80211_wx.c
@@ -708,7 +708,7 @@ int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee,
} else
idx = ieee->tx_keyidx;
- if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
+ if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
ext->alg != IW_ENCODE_ALG_WEP)
if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA)
return -EINVAL;
On 10/8/07, Alexey Dobriyan <[email protected]> wrote:
> On Mon, Oct 08, 2007 at 10:05:40AM -0700, [email protected] wrote:
> > --- a/mm/fremap.c~fix-vm_can_nonlinear-check-in-sys_remap_file_pages
> > +++ a/mm/fremap.c
> > @@ -160,7 +160,7 @@ asmlinkage long sys_remap_file_pages(uns
> > if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
> > goto out;
> >
> > - if (!vma->vm_flags & VM_CAN_NONLINEAR)
> > + if (!(vma->vm_flags & VM_CAN_NONLINEAR))
>
> Ick.
Perhaps a good candidate for checkpatch.pl? (Andy cc:d.)
Ray
On Mon, Oct 08, 2007 at 10:40:44PM +0400, Alexey Dobriyan wrote:
> On Mon, Oct 08, 2007 at 10:05:40AM -0700, [email protected] wrote:
> > --- a/mm/fremap.c~fix-vm_can_nonlinear-check-in-sys_remap_file_pages
> > +++ a/mm/fremap.c
> > @@ -160,7 +160,7 @@ asmlinkage long sys_remap_file_pages(uns
> > if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
> > goto out;
> >
> > - if (!vma->vm_flags & VM_CAN_NONLINEAR)
> > + if (!(vma->vm_flags & VM_CAN_NONLINEAR))
>
> Ick.
>
> [PATCH] typo time?
>
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
[snip]
Well, well... For the sake of experiment I'd modified sparse with
--- a/evaluate.c
+++ b/evaluate.c
@@ -916,6 +916,7 @@ static struct symbol *evaluate_binop(struct expression *expr)
rtype = integer_promotion(rtype);
} else {
// The rest do usual conversions
+ if (op == '&' && expr->left->type == EXPR_PREOP &&
+ expr->left->op == '!')
+ warning(expr->pos, "dubious: !x & y");
ltype = usual_conversions(op, expr->left, expr->right,
lclass, rclass, ltype, rtype);
ctype = rtype = ltype;
and ran cross-builds. Very nice hit rate:
* all places caught by Alexey's patch caught by that
* a bunch of additional bugs found
* a bunch of harmless but dumb (&& misspelled as & for no reason, etc.)
* one "don't know what they are doing, but it's certainly not right"
case (asus-laptop one below)
and no false positives. They _are_ possible (& deliberately used in something
like !foo() & !bar() to get both called), but none had been there in the
kernel.
Trying to go for a wider patterns like that (!x | y, x & !y, x | !y) had not
caught anything useful (one borderline case in mm/page_alloc.c - | used
instead of || for no good reason, etc.). It had found a lot of rather
revolting bitbanging, but that's it (
(!!test_bit(A, x)) << 2 | (!!test_bit(B, x)) << 1 | !!test_bit(C,x)
- that kind of thing).
Here's the list of what got caught, the patch incremental to Alexey's in the
end of posting.
arch/ia64/kernel/acpi.c:861:28: warning: dubious: !x & y
if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
(!lsapic->lapic_flags & ACPI_MADT_ENABLED)) {
Bug (missing parens)
arch/sparc64/kernel/time.c:1071:23: warning: dubious: !x & y
if (!mregs && !dregs & !bregs)
return -1;
Harmless, but dumb (& -> &&)
drivers/acpi/asus_acpi.c:599:22: warning: dubious: !x & y
if (invert) /* invert target value */
led_out = !led_out & 0x1;
Extremely dumb in any reading (led_out is 0 or 1 when we get here)
drivers/acpi/battery.c:423:45: warning: dubious: !x & y
if ((!battery->flags.battery_present_prev & acpi_battery_present(battery))
|| (battery->flags.battery_present_prev & !acpi_battery_present(battery))) {
Misspelled !=, actually (.battery_present_prev had been assigned acpi_batter_present()
at earlier point)
drivers/acpi/battery.c:451:44: warning: dubious: !x & y
if ((!battery->flags.battery_present_prev &
acpi_battery_present(battery)) ||
(battery->flags.battery_present_prev &
!acpi_battery_present(battery))) {
Ditto.
drivers/block/paride/pt.c:663:19: warning: dubious: !x & y
drivers/block/paride/pt.c:667:20: warning: dubious: !x & y
drivers/block/pktcdvd.c:2207:14: warning: dubious: !x & y
drivers/block/pktcdvd.c:2211:14: warning: dubious: !x & y
Bugs, covered by Alexey's patch
drivers/char/isicom.c:1530:23: warning: dubious: !x & y
if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 &&
portcount != 8 && portcount != 16)) {
Bug (missing parens).
drivers/isdn/act2000/module.c:313:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:342:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:350:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:354:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:369:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:389:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:397:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:404:21: warning: dubious: !x & y
drivers/isdn/act2000/module.c:527:34: warning: dubious: !x & y
drivers/isdn/act2000/module.c:542:34: warning: dubious: !x & y
drivers/isdn/act2000/module.c:557:34: warning: dubious: !x & y
drivers/isdn/i4l/isdn_ttyfax.c:837:24: warning: dubious: !x & y
Bugs (covered by Alexey's patch)
drivers/isdn/i4l/isdn_ttyfax.c:909:60: warning: dubious: !x & y
if ((f->phase != ISDN_FAX_PHASE_D) || (!info->faxonline & 1))
Bug (missing parens)
drivers/isdn/icn/icn.c:1305:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1331:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1351:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1369:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1378:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1394:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1408:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1427:21: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1474:20: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1489:20: warning: dubious: !x & y
drivers/isdn/icn/icn.c:1504:20: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1187:21: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1213:21: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1241:21: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1267:22: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1276:22: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1306:22: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1398:20: warning: dubious: !x & y
drivers/isdn/isdnloop/isdnloop.c:1413:20: warning: dubious: !x & y
drivers/media/video/pvrusb2/pvrusb2-ctrl.c:413:12: warning: dubious: !x & y
Covered by Alexey's patch
drivers/isdn/isdnloop/isdnloop.c:1292:22: warning: dubious: !x & y
if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
drivers/isdn/isdnloop/isdnloop.c:1336:22: warning: dubious: !x & y
if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
drivers/isdn/isdnloop/isdnloop.c:1383:20: warning: dubious: !x & y
if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
Missing parens in all cases
drivers/misc/asus-laptop.c:325:14: warning: dubious: !x & y
out = !out & 0x1;
Hell knows what's going on there, very odd code around.
drivers/net/eepro.c:642:40: warning: dubious: !x & y
printk(KERN_DEBUG " AutoPort: %d\n", GetBit(!Word,ee_Jabber));
Probably a bug
drivers/net/tokenring/olympic.c:360:38: warning: dubious: !x & y
while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) {
Missing parens (definitely - CLKCTL_PAUSE is 1<<15)
drivers/net/wireless/airo.c:6420:20: warning: dubious: !x & y
drivers/net/wireless/atmel.c:1764:21: warning: dubious: !x & y
Covered by Alexey's patch
drivers/net/wireless/libertas/wext.c:1541:22: warning: dubious: !x & y
if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
Missing parens
drivers/net/wireless/prism54/isl_ioctl.c:1121:21: warning: dubious: !x & y
drivers/net/wireless/prism54/isl_ioctl.c:2633:30: warning: dubious: !x & y
drivers/net/wireless/zd1211rw/zd_rf_uw2453.c:406:20: warning: dubious: !x & y
Covered by Alexey's patch
drivers/s390/cio/cmf.c:339:30: warning: dubious: !x & y
drivers/s390/cio/cmf.c:342:31: warning: dubious: !x & y
if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) &&
(sch->schib.scsw.actl &
(SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) &&
(!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS))
Missing parens
drivers/scsi/atari_NCR5380.c:1873:43: warning: dubious: !x & y
while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ)
Missing parens
drivers/scsi/sun3_NCR5380.c:1867:46: warning: dubious: !x & y
while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);
Ditto
drivers/serial/m32r_sio.c:424:35: warning: dubious: !x & y
while (!serial_in(up, UART_LSR) & UART_LSR_THRE);
Ditto
drivers/usb/core/hub.c:332:25: warning: dubious: !x & y
if (!hub->disconnected & list_empty(&hub->event_list)) {
Harmless, but odd (& -> &&)
drivers/video/i810/i810_main.c:1479:22: warning: dubious: !x & y
drivers/video/sis/sis_main.c:430:19: warning: dubious: !x & y
fs/ocfs2/alloc.c:3964:20: warning: dubious: !x & y
Covered by Alexey's patch
fs/ocfs2/dlmglue.c:673:2: warning: dubious: !x & y
BUG_ON((!lockres->l_flags & OCFS2_LOCK_BUSY));
Missing parens
fs/reiserfs/super.c:1993:47: warning: dubious: !x & y
if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) {
Missing parens
mm/fremap.c:163:21: warning: dubious: !x & y
Covered by patch in -mm that had started that
net/ieee80211/ieee80211_wx.c:711:22: warning: dubious: !x & y
Covered by Alexey's patch
-----------------------------------------------------------------------
Misc bugs caught by looking for !x & y in the tree
Signed-off-by: Al Viro <[email protected]>
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3d45d24..7d78d22 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -858,7 +858,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
- (!lsapic->lapic_flags & ACPI_MADT_ENABLED)) {
+ (!(lsapic->lapic_flags & ACPI_MADT_ENABLED))) {
kfree(buffer.pointer);
return -EINVAL;
}
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 69cad1b..23a51ab 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -1068,7 +1068,7 @@ static int set_rtc_mmss(unsigned long nowtime)
* Not having a register set can lead to trouble.
* Also starfire doesn't have a tod clock.
*/
- if (!mregs && !dregs & !bregs)
+ if (!mregs && !dregs && !bregs)
return -1;
if (mregs) {
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d915fec..1db2055 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -596,7 +596,7 @@ write_led(const char __user * buffer, unsigned long count,
(led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask);
if (invert) /* invert target value */
- led_out = !led_out & 0x1;
+ led_out = !led_out;
if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 9b2c0f7..3762ce2 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -420,8 +420,7 @@ static int acpi_battery_update(struct acpi_battery *battery,
result = acpi_battery_get_status(battery);
if (result)
goto end;
- if ((!battery->flags.battery_present_prev & acpi_battery_present(battery))
- || (battery->flags.battery_present_prev & !acpi_battery_present(battery))) {
+ if (battery->flags.battery_present_prev != acpi_battery_present(battery)) {
result = acpi_battery_init_update(battery);
if (result)
goto end;
@@ -448,10 +447,7 @@ static void acpi_battery_notify_update(struct acpi_battery *battery)
return;
}
- if ((!battery->flags.battery_present_prev &
- acpi_battery_present(battery)) ||
- (battery->flags.battery_present_prev &
- !acpi_battery_present(battery))) {
+ if (battery->flags.battery_present_prev != acpi_battery_present(battery)) {
battery->flags.init_update = 1;
} else {
battery->flags.update[ACPI_BATTERY_INFO] = 1;
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c
index 77a7a4a..1c14ec5 100644
--- a/drivers/char/isicom.c
+++ b/drivers/char/isicom.c
@@ -1527,7 +1527,7 @@ static int __devinit reset_card(struct pci_dev *pdev,
msleep(10);
portcount = inw(base + 0x2);
- if (!inw(base + 0xe) & 0x1 || (portcount != 0 && portcount != 4 &&
+ if (!(inw(base + 0xe) & 0x1) || (portcount != 0 && portcount != 4 &&
portcount != 8 && portcount != 16)) {
dev_err(&pdev->dev, "ISILoad:PCI Card%d reset failure.",
card + 1);
diff --git a/drivers/isdn/i4l/isdn_ttyfax.c b/drivers/isdn/i4l/isdn_ttyfax.c
index a943d07..6081b3f 100644
--- a/drivers/isdn/i4l/isdn_ttyfax.c
+++ b/drivers/isdn/i4l/isdn_ttyfax.c
@@ -906,7 +906,7 @@ isdn_tty_cmd_FCLASS2(char **p, modem_info * info)
sprintf(rs, "\r\n0-2");
isdn_tty_at_cout(rs, info);
} else {
- if ((f->phase != ISDN_FAX_PHASE_D) || (!info->faxonline & 1))
+ if ((f->phase != ISDN_FAX_PHASE_D) || !(info->faxonline & 1))
PARSE_ERROR1;
par = isdn_getnum(p);
if ((par < 0) || (par > 2))
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index bb92e3c..8a8b20d 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -1289,7 +1289,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_CLREAZ:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
if (card->leased)
break;
@@ -1333,7 +1333,7 @@ isdnloop_command(isdn_ctrl * c, isdnloop_card * card)
}
break;
case ISDN_CMD_SETL3:
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
return 0;
default:
@@ -1380,7 +1380,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int channel)
isdnloop_card *card = isdnloop_findcard(id);
if (card) {
- if (!card->flags & ISDNLOOP_FLAGS_RUNNING)
+ if (!(card->flags & ISDNLOOP_FLAGS_RUNNING))
return -ENODEV;
return (isdnloop_writecmd(buf, len, 1, card));
}
diff --git a/drivers/net/tokenring/olympic.c b/drivers/net/tokenring/olympic.c
index 09b3cfb..28c7482 100644
--- a/drivers/net/tokenring/olympic.c
+++ b/drivers/net/tokenring/olympic.c
@@ -357,7 +357,7 @@ static int __devinit olympic_init(struct net_device *dev)
if(!(readl(olympic_mmio+BCTL) & BCTL_MODE_INDICATOR)) {
t=jiffies;
- while (!readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE) {
+ while (!(readl(olympic_mmio+CLKCTL) & CLKCTL_PAUSE)) {
schedule() ;
if(time_after(jiffies, t + 2*HZ)) {
printk(KERN_ERR "IBM Cardbus tokenring adapter not responsing.\n") ;
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 2fcc3bf..edd4395 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1538,7 +1538,7 @@ static int wlan_get_encodeext(struct net_device *dev,
index = adapter->wep_tx_keyidx;
}
- if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
+ if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
ext->alg != IW_ENCODE_ALG_WEP) {
if (index != 0 || adapter->mode != IW_MODE_INFRA)
goto out;
diff --git a/drivers/s390/cio/cmf.c b/drivers/s390/cio/cmf.c
index 34a7969..a6302a3 100644
--- a/drivers/s390/cio/cmf.c
+++ b/drivers/s390/cio/cmf.c
@@ -336,10 +336,10 @@ static int cmf_copy_block(struct ccw_device *cdev)
if (sch->schib.scsw.fctl & SCSW_FCTL_START_FUNC) {
/* Don't copy if a start function is in progress. */
- if ((!sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) &&
+ if (!(sch->schib.scsw.actl & SCSW_ACTL_SUSPENDED) &&
(sch->schib.scsw.actl &
(SCSW_ACTL_DEVACT | SCSW_ACTL_SCHACT)) &&
- (!sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS))
+ !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS))
return -EBUSY;
}
cmb_data = cdev->private->cmb;
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c
index 03dbe60..5696588 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -1870,7 +1870,7 @@ static int do_abort(struct Scsi_Host *host)
* the target sees, so we just handshake.
*/
- while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ)
+ while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ))
;
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c
index de73393..9337465 100644
--- a/drivers/scsi/sun3_NCR5380.c
+++ b/drivers/scsi/sun3_NCR5380.c
@@ -1864,7 +1864,7 @@ static int do_abort (struct Scsi_Host *host)
* the target sees, so we just handshake.
*/
- while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);
+ while (!((tmp = NCR5380_read(STATUS_REG)) & SR_REQ));
NCR5380_write(TARGET_COMMAND_REG, PHASE_SR_TO_TCR(tmp));
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 6e09c8b..d71f7bd 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -421,7 +421,7 @@ static void transmit_chars(struct uart_sio_port *up)
up->port.icount.tx++;
if (uart_circ_empty(xmit))
break;
- while (!serial_in(up, UART_LSR) & UART_LSR_THRE);
+ while (!(serial_in(up, UART_LSR) & UART_LSR_THRE));
} while (--count > 0);
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index f7b337f..b6ff0cc 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -329,7 +329,7 @@ static void kick_khubd(struct usb_hub *hub)
to_usb_interface(hub->intfdev)->pm_usage_cnt = 1;
spin_lock_irqsave(&hub_event_lock, flags);
- if (!hub->disconnected & list_empty(&hub->event_list)) {
+ if (!hub->disconnected && list_empty(&hub->event_list)) {
list_add_tail(&hub->event_list, &hub_event_list);
wake_up(&khubd_wait);
}
diff --git a/fs/block_dev.c b/fs/block_dev.c
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index f71250e..da94956 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -670,7 +670,7 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc
{
mlog_entry_void();
- BUG_ON((!lockres->l_flags & OCFS2_LOCK_BUSY));
+ BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY));
BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED);
if (lockres->l_requested > LKM_NLMODE &&
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index a005451..630a7eb 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -1990,7 +1990,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id,
return -EXDEV;
}
/* We must not pack tails for quota files on reiserfs for quota IO to work */
- if (!REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask) {
+ if (!(REISERFS_I(nd.dentry->d_inode)->i_flags & i_nopack_mask)) {
reiserfs_warning(sb,
"reiserfs: Quota file must have tail packing disabled.");
path_release(&nd);
diff --git a/include/linux/fs.h b/include/linux/fs.h
On Mon, 8 Oct 2007 22:40:44 +0400
Alexey Dobriyan <[email protected]> wrote:
> On Mon, Oct 08, 2007 at 10:05:40AM -0700, [email protected] wrote:
> > --- a/mm/fremap.c~fix-vm_can_nonlinear-check-in-sys_remap_file_pages
> > +++ a/mm/fremap.c
> > @@ -160,7 +160,7 @@ asmlinkage long sys_remap_file_pages(uns
> > if (vma->vm_private_data && !(vma->vm_flags & VM_NONLINEAR))
> > goto out;
> >
> > - if (!vma->vm_flags & VM_CAN_NONLINEAR)
> > + if (!(vma->vm_flags & VM_CAN_NONLINEAR))
>
> Ick.
>
> [PATCH] typo time?
I appreciate the patch, but that changelog is just stupid. Effectively
what it says is "Andrew, you get to type one up". I'd prefer not to,
please.
> Signed-off-by: Alexey Dobriyan <[email protected]>
> ---
>
> drivers/block/paride/pt.c | 2 -
> drivers/block/pktcdvd.c | 4 +--
> drivers/isdn/act2000/module.c | 22 ++++++++---------
> drivers/isdn/i4l/isdn_ttyfax.c | 2 -
> drivers/isdn/icn/icn.c | 22 ++++++++---------
> drivers/isdn/isdnloop/isdnloop.c | 16 ++++++------
> drivers/media/video/pvrusb2/pvrusb2-ctrl.c | 2 -
> drivers/net/wireless/airo.c | 2 -
> drivers/net/wireless/atmel.c | 2 -
> drivers/net/wireless/prism54/isl_ioctl.c | 4 +--
> drivers/net/wireless/zd1211rw/zd_rf_uw2453.c | 2 -
> drivers/video/i810/i810_main.c | 2 -
> drivers/video/sis/sis_main.c | 2 -
> fs/ocfs2/alloc.c | 2 -
> net/ieee80211/ieee80211_wx.c | 2 -
> 15 files changed, 44 insertions(+), 44 deletions(-)
seven different maintainers need to review and ack this. Sigh.