All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] adjust suspicious bit operation
@ 2012-06-06 21:41 ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches relate to conditional tests where & is used with a constant
that is always 0 and where | is used with a constant that is always 0 or
always non-zero.

The following semantic match finds these problems
(http://coccinelle.lip6.fr/):

@and@
identifier i;
expression e;
position p;
@@

 ((e & i@p) && ...)

@iszera@
identifier and.i;
position p;
@@

#define i 0

@othera@
identifier and.i;
expression e!=0;
@@

#define i e

@script:python depends on iszera && !othera@
p << and.p;
@@

cocci.print_main("",p)

@or@
identifier i;
expression e;
position p;
@@

 ((e | i@p) && ...)


@iszero@
identifier or.i;
position p;
@@

#define i 0

@othero@
identifier or.i;
expression e!=0;
@@

#define i e

@script:python depends on (othero && !iszero) || (iszero && !othero)@
p << or.p;
@@

cocci.print_main("",p)


^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 0/7] adjust suspicious bit operation
@ 2012-06-06 21:41 ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches relate to conditional tests where & is used with a constant
that is always 0 and where | is used with a constant that is always 0 or
always non-zero.

The following semantic match finds these problems
(http://coccinelle.lip6.fr/):

@and@
identifier i;
expression e;
position p;
@@

 ((e & i@p) && ...)

@iszera@
identifier and.i;
position p;
@@

#define i 0

@othera@
identifier and.i;
expression e!=0;
@@

#define i e

@script:python depends on iszera && !othera@
p << and.p;
@@

cocci.print_main("",p)

@or@
identifier i;
expression e;
position p;
@@

 ((e | i@p) && ...)


@iszero@
identifier or.i;
position p;
@@

#define i 0

@othero@
identifier or.i;
expression e!=0;
@@

#define i e

@script:python depends on (othero && !iszero) || (iszero && !othero)@
p << or.p;
@@

cocci.print_main("",p)


^ permalink raw reply	[flat|nested] 49+ messages in thread

* [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: David S. Miller
  Cc: kernel-janitors, linux-ide, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/ide/ide-cs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..a5e57bf 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;
 
-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: David S. Miller
  Cc: kernel-janitors, linux-ide, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/ide/ide-cs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..a5e57bf 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;
 
-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 2/7] drivers/staging/comedi/drivers/me4000.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Ian Abbott
  Cc: kernel-janitors, Mori Hess, Greg Kroah-Hartman, devel,
	linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

TRIG_ROUND_NEAREST is 0, so a bit-and with it is always false.  The
value TRIG_ROUND_MASK covers the bits of the TRIG_ROUND constants, so
first pick those bits and then make the test using ==.

The same is done for TRIG_ROUND_UP for symmetry, even though bit-and would
be sufficient in this case.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
The TRIG_ROUND_UP case could be left as is, if that is preferred.  Or a
temporary variable could be introduced to avoid anding with the mask twice.

Actually, the following code suggests that the mask is not necessary, == would be sufficient:
	/* Only rounding flags are implemented */
        cmd->flags &= TRIG_ROUND_NEAREST | TRIG_ROUND_UP | TRIG_ROUND_DOWN;
But using the mask is safer, if there are future extensions.

 drivers/staging/comedi/drivers/me4000.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 8ca1b54..fc60117 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -949,10 +949,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*init_ticks = (cmd->start_arg * 33) / 1000;
 		rest = (cmd->start_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*init_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) {
 			if (rest)
 				(*init_ticks)++;
 		}
@@ -962,10 +962,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*scan_ticks = (cmd->scan_begin_arg * 33) / 1000;
 		rest = (cmd->scan_begin_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*scan_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) {
 			if (rest)
 				(*scan_ticks)++;
 		}
@@ -975,10 +975,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*chan_ticks = (cmd->convert_arg * 33) / 1000;
 		rest = (cmd->convert_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*chan_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) == TRIG_ROUND_UP) {
 			if (rest)
 				(*chan_ticks)++;
 		}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 2/7] drivers/staging/comedi/drivers/me4000.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Ian Abbott
  Cc: kernel-janitors, Mori Hess, Greg Kroah-Hartman, devel,
	linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

TRIG_ROUND_NEAREST is 0, so a bit-and with it is always false.  The
value TRIG_ROUND_MASK covers the bits of the TRIG_ROUND constants, so
first pick those bits and then make the test using =.

The same is done for TRIG_ROUND_UP for symmetry, even though bit-and would
be sufficient in this case.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
The TRIG_ROUND_UP case could be left as is, if that is preferred.  Or a
temporary variable could be introduced to avoid anding with the mask twice.

Actually, the following code suggests that the mask is not necessary, = would be sufficient:
	/* Only rounding flags are implemented */
        cmd->flags &= TRIG_ROUND_NEAREST | TRIG_ROUND_UP | TRIG_ROUND_DOWN;
But using the mask is safer, if there are future extensions.

 drivers/staging/comedi/drivers/me4000.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 8ca1b54..fc60117 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -949,10 +949,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*init_ticks = (cmd->start_arg * 33) / 1000;
 		rest = (cmd->start_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*init_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_UP) {
 			if (rest)
 				(*init_ticks)++;
 		}
@@ -962,10 +962,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*scan_ticks = (cmd->scan_begin_arg * 33) / 1000;
 		rest = (cmd->scan_begin_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*scan_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_UP) {
 			if (rest)
 				(*scan_ticks)++;
 		}
@@ -975,10 +975,10 @@ static int ai_round_cmd_args(struct comedi_device *dev,
 		*chan_ticks = (cmd->convert_arg * 33) / 1000;
 		rest = (cmd->convert_arg * 33) % 1000;
 
-		if (cmd->flags & TRIG_ROUND_NEAREST) {
+		if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_NEAREST) {
 			if (rest > 33)
 				(*chan_ticks)++;
-		} else if (cmd->flags & TRIG_ROUND_UP) {
+		} else if ((cmd->flags & TRIG_ROUND_MASK) = TRIG_ROUND_UP) {
 			if (rest)
 				(*chan_ticks)++;
 		}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-kernel,
	joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
nonzero result.  The test is rewritten as done elsewhere in the same file.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/usb/gadget/pch_udc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 1cfcc9e..79f7a53 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep)
 			return;
 		}
 		if ((td->status & PCH_UDC_BUFF_STS) == PCH_UDC_BS_DMA_DONE)
-			if (td->status | PCH_UDC_DMA_LAST) {
+			if ((td_data->status & PCH_UDC_DMA_LAST)
+			    == PCH_UDC_DMA_LAST) {
 				count = td->status & PCH_UDC_RXTX_BYTES;
 				break;
 			}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-kernel,
	joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
nonzero result.  The test is rewritten as done elsewhere in the same file.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/usb/gadget/pch_udc.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 1cfcc9e..79f7a53 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep)
 			return;
 		}
 		if ((td->status & PCH_UDC_BUFF_STS) = PCH_UDC_BS_DMA_DONE)
-			if (td->status | PCH_UDC_DMA_LAST) {
+			if ((td_data->status & PCH_UDC_DMA_LAST)
+			    = PCH_UDC_DMA_LAST) {
 				count = td->status & PCH_UDC_RXTX_BYTES;
 				break;
 			}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Alexander Viro
  Cc: kernel-janitors, linux-fsdevel, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

READ is 0, so the result of the bit-and operation is 0.  Rewrite with == as
done elsewhere in the same file.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 fs/direct-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 0c85fae..1faf4cb 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1258,7 +1258,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 	 */
 	BUG_ON(retval == -EIOCBQUEUED);
 	if (dio->is_async && retval == 0 && dio->result &&
-	    ((rw & READ) || (dio->result == sdio.size)))
+	    ((rw == READ) || (dio->result == sdio.size)))
 		retval = -EIOCBQUEUED;
 
 	if (retval != -EIOCBQUEUED)


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Alexander Viro
  Cc: kernel-janitors, linux-fsdevel, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

READ is 0, so the result of the bit-and operation is 0.  Rewrite with = as
done elsewhere in the same file.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 fs/direct-io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/direct-io.c b/fs/direct-io.c
index 0c85fae..1faf4cb 100644
--- a/fs/direct-io.c
+++ b/fs/direct-io.c
@@ -1258,7 +1258,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
 	 */
 	BUG_ON(retval = -EIOCBQUEUED);
 	if (dio->is_async && retval = 0 && dio->result &&
-	    ((rw & READ) || (dio->result = sdio.size)))
+	    ((rw = READ) || (dio->result = sdio.size)))
 		retval = -EIOCBQUEUED;
 
 	if (retval != -EIOCBQUEUED)


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Brett Rudley
  Cc: kernel-janitors, Roland Vossen, Arend van Spriel,
	Franky (Zhenhui) Lin, Kan Yan, John W. Linville, linux-wireless,
	netdev, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IRQF_TRIGGER_HIGH is 0x00000004, so it seems that & was intended rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index e2480d1..bed208f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -91,7 +91,7 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
 
 	/* redirect, configure ane enable io for interrupt signal */
 	data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
-	if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH)
+	if (sdiodev->irq_flags & IRQF_TRIGGER_HIGH)
 		data |= SDIO_SEPINT_ACT_HI;
 	brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
 


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Brett Rudley
  Cc: kernel-janitors, Roland Vossen, Arend van Spriel,
	Franky (Zhenhui) Lin, Kan Yan, John W. Linville, linux-wireless,
	netdev, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IRQF_TRIGGER_HIGH is 0x00000004, so it seems that & was intended rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index e2480d1..bed208f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -91,7 +91,7 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
 
 	/* redirect, configure ane enable io for interrupt signal */
 	data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
-	if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH)
+	if (sdiodev->irq_flags & IRQF_TRIGGER_HIGH)
 		data |= SDIO_SEPINT_ACT_HI;
 	brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
 


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 6/7] drivers/ata/pata_pcmcia.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: kernel-janitors, linux-ide, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/ata/pata_pcmcia.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index a808ba0..776e749 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -170,7 +170,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;
 
-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 6/7] drivers/ata/pata_pcmcia.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: kernel-janitors, linux-ide, linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/ata/pata_pcmcia.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c
index a808ba0..776e749 100644
--- a/drivers/ata/pata_pcmcia.c
+++ b/drivers/ata/pata_pcmcia.c
@@ -170,7 +170,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;
 
-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation
  2012-06-06 21:41 ` Julia Lawall
@ 2012-06-06 21:41   ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: kernel-janitors, Marc Kleine-Budde, linux-can, netdev,
	linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
 	struct cc770_platform_data *pdata = pdev->dev.platform_data;
 
 	priv->can.clock.freq = pdata->osc_freq;
-	if (priv->cpu_interface | CPUIF_DSC)
+	if (priv->cpu_interface & CPUIF_DSC)
 		priv->can.clock.freq /= 2;
 	priv->clkout = pdata->cor;
 	priv->bus_config = pdata->bcr;

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation
@ 2012-06-06 21:41   ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-06 21:41 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: kernel-janitors, Marc Kleine-Budde, linux-can, netdev,
	linux-kernel, joe, Julia Lawall

From: Julia Lawall <Julia.Lawall@lip6.fr>

CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/can/cc770/cc770_platform.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
 	struct cc770_platform_data *pdata = pdev->dev.platform_data;
 
 	priv->can.clock.freq = pdata->osc_freq;
-	if (priv->cpu_interface | CPUIF_DSC)
+	if (priv->cpu_interface & CPUIF_DSC)
 		priv->can.clock.freq /= 2;
 	priv->clkout = pdata->cor;
 	priv->bus_config = pdata->bcr;


^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation
  2012-06-06 21:41   ` Julia Lawall
@ 2012-06-06 21:52     ` Marc Kleine-Budde
  -1 siblings, 0 replies; 49+ messages in thread
From: Marc Kleine-Budde @ 2012-06-06 21:52 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Wolfgang Grandegger, kernel-janitors, linux-can, netdev,
	linux-kernel, joe, Julia Lawall

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

On 06/06/2012 11:41 PM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Good catch, Joe Perches has already found and fixed that problem. It has
been fixed in:

    dc605db can: cc770: Fix likely misuse of | for &

The commit is currently in David's net/master, and scheduled for the
v3.5 release.

Regards, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: adjust suspicious bit operation
@ 2012-06-06 21:52     ` Marc Kleine-Budde
  0 siblings, 0 replies; 49+ messages in thread
From: Marc Kleine-Budde @ 2012-06-06 21:52 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Wolfgang Grandegger, kernel-janitors, linux-can, netdev,
	linux-kernel, joe, Julia Lawall

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

On 06/06/2012 11:41 PM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> CPUIF_DSC is 0x40, so it would seem that & is wanted rather than |.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>

Good catch, Joe Perches has already found and fixed that problem. It has
been fixed in:

    dc605db can: cc770: Fix likely misuse of | for &

The commit is currently in David's net/master, and scheduled for the
v3.5 release.

Regards, Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit operation
@ 2012-06-06 23:43     ` Franky Lin
  0 siblings, 0 replies; 49+ messages in thread
From: Franky Lin @ 2012-06-06 23:43 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Brett Rudley, kernel-janitors, Roland Vossen, Arend van Spriel,
	Kan Yan, John W. Linville, linux-wireless, netdev, linux-kernel,
	joe, Julia Lawall

On 06/06/2012 02:41 PM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> IRQF_TRIGGER_HIGH is 0x00000004, so it seems that&  was intended rather than |.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
> Signed-off-by: Julia Lawall<julia@diku.dk>

Thanks, Julia. But this has already been fixed by Joe Perches [1] and 
the patch has arrived at Linux wireless tree.

Franky

[1] https://lkml.org/lkml/2012/5/30/482


^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit operation
@ 2012-06-06 23:43     ` Franky Lin
  0 siblings, 0 replies; 49+ messages in thread
From: Franky Lin @ 2012-06-06 23:43 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Brett Rudley, kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	Roland Vossen, Arend van Spriel, Kan Yan, John W. Linville,
	linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, joe-6d6DIl74uiNBDgjK7y7TUQ,
	Julia Lawall

On 06/06/2012 02:41 PM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
>
> IRQF_TRIGGER_HIGH is 0x00000004, so it seems that&  was intended rather than |.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
> Signed-off-by: Julia Lawall<julia-dAYI7NvHqcQ@public.gmane.org>

Thanks, Julia. But this has already been fixed by Joe Perches [1] and 
the patch has arrived at Linux wireless tree.

Franky

[1] https://lkml.org/lkml/2012/5/30/482

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit
@ 2012-06-06 23:43     ` Franky Lin
  0 siblings, 0 replies; 49+ messages in thread
From: Franky Lin @ 2012-06-06 23:43 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Brett Rudley, kernel-janitors, Roland Vossen, Arend van Spriel,
	Kan Yan, John W. Linville, linux-wireless, netdev, linux-kernel,
	joe, Julia Lawall

On 06/06/2012 02:41 PM, Julia Lawall wrote:
> From: Julia Lawall<Julia.Lawall@lip6.fr>
>
> IRQF_TRIGGER_HIGH is 0x00000004, so it seems that&  was intended rather than |.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
> Signed-off-by: Julia Lawall<julia@diku.dk>

Thanks, Julia. But this has already been fixed by Joe Perches [1] and 
the patch has arrived at Linux wireless tree.

Franky

[1] https://lkml.org/lkml/2012/5/30/482


^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-06 21:41   ` Julia Lawall
@ 2012-06-07 13:00     ` Sergei Shtylyov
  -1 siblings, 0 replies; 49+ messages in thread
From: Sergei Shtylyov @ 2012-06-07 13:00 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Felipe Balbi, kernel-janitors, Greg Kroah-Hartman, linux-usb,
	linux-kernel, joe, Julia Lawall

Hello.

On 07-06-2012 1:41, Julia Lawall wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>

> PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
> nonzero result.  The test is rewritten as done elsewhere in the same file.

> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

> Signed-off-by: Julia Lawall<julia@diku.dk>

> ---
>   drivers/usb/gadget/pch_udc.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
> index 1cfcc9e..79f7a53 100644
> --- a/drivers/usb/gadget/pch_udc.c
> +++ b/drivers/usb/gadget/pch_udc.c
> @@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep)
>   			return;
>   		}
>   		if ((td->status&  PCH_UDC_BUFF_STS) == PCH_UDC_BS_DMA_DONE)
> -			if (td->status | PCH_UDC_DMA_LAST) {
> +			if ((td_data->status&  PCH_UDC_DMA_LAST)
> +			    == PCH_UDC_DMA_LAST) {

    But why not simply:

			if (td_data->status & PCH_UDC_DMA_LAST)

if the constant is single bit anyway? And are you sure about s/td/td_data/?

WBR, Sergei

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-07 13:00     ` Sergei Shtylyov
  0 siblings, 0 replies; 49+ messages in thread
From: Sergei Shtylyov @ 2012-06-07 13:00 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Felipe Balbi, kernel-janitors, Greg Kroah-Hartman, linux-usb,
	linux-kernel, joe, Julia Lawall

Hello.

On 07-06-2012 1:41, Julia Lawall wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>

> PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
> nonzero result.  The test is rewritten as done elsewhere in the same file.

> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

> Signed-off-by: Julia Lawall<julia@diku.dk>

> ---
>   drivers/usb/gadget/pch_udc.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
> index 1cfcc9e..79f7a53 100644
> --- a/drivers/usb/gadget/pch_udc.c
> +++ b/drivers/usb/gadget/pch_udc.c
> @@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct pch_udc_ep *ep)
>   			return;
>   		}
>   		if ((td->status&  PCH_UDC_BUFF_STS) = PCH_UDC_BS_DMA_DONE)
> -			if (td->status | PCH_UDC_DMA_LAST) {
> +			if ((td_data->status&  PCH_UDC_DMA_LAST)
> +			    = PCH_UDC_DMA_LAST) {

    But why not simply:

			if (td_data->status & PCH_UDC_DMA_LAST)

if the constant is single bit anyway? And are you sure about s/td/td_data/?

WBR, Sergei

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-07 13:00     ` Sergei Shtylyov
@ 2012-06-07 14:23       ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-07 14:23 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Felipe Balbi, kernel-janitors, Greg Kroah-Hartman,
	linux-usb, linux-kernel, joe, Julia Lawall



On Thu, 7 Jun 2012, Sergei Shtylyov wrote:

> Hello.
>
> On 07-06-2012 1:41, Julia Lawall wrote:
>
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
>> PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
>> nonzero result.  The test is rewritten as done elsewhere in the same file.
>
>> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
>> Signed-off-by: Julia Lawall<julia@diku.dk>
>
>> ---
>>   drivers/usb/gadget/pch_udc.c |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
>> index 1cfcc9e..79f7a53 100644
>> --- a/drivers/usb/gadget/pch_udc.c
>> +++ b/drivers/usb/gadget/pch_udc.c
>> @@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct 
>> pch_udc_ep *ep)
>>   			return;
>>   		}
>>   		if ((td->status&  PCH_UDC_BUFF_STS) == PCH_UDC_BS_DMA_DONE)
>> -			if (td->status | PCH_UDC_DMA_LAST) {
>> +			if ((td_data->status&  PCH_UDC_DMA_LAST)
>> +			    == PCH_UDC_DMA_LAST) {
>
>   But why not simply:
>
> 			if (td_data->status & PCH_UDC_DMA_LAST)
>
> if the constant is single bit anyway? And are you sure about s/td/td_data/?

Oops, thanks for noticing that.  I'll send a corrected version.

thanks,
julia

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-07 14:23       ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-07 14:23 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Julia Lawall, Felipe Balbi, kernel-janitors, Greg Kroah-Hartman,
	linux-usb, linux-kernel, joe, Julia Lawall



On Thu, 7 Jun 2012, Sergei Shtylyov wrote:

> Hello.
>
> On 07-06-2012 1:41, Julia Lawall wrote:
>
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
>> PCH_UDC_DMA_LAST is 0x08000000 so a bit-or with this value always gives a
>> nonzero result.  The test is rewritten as done elsewhere in the same file.
>
>> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
>
>> Signed-off-by: Julia Lawall<julia@diku.dk>
>
>> ---
>>   drivers/usb/gadget/pch_udc.c |    3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
>> index 1cfcc9e..79f7a53 100644
>> --- a/drivers/usb/gadget/pch_udc.c
>> +++ b/drivers/usb/gadget/pch_udc.c
>> @@ -2208,7 +2208,8 @@ static void pch_udc_complete_receiver(struct 
>> pch_udc_ep *ep)
>>   			return;
>>   		}
>>   		if ((td->status&  PCH_UDC_BUFF_STS) = PCH_UDC_BS_DMA_DONE)
>> -			if (td->status | PCH_UDC_DMA_LAST) {
>> +			if ((td_data->status&  PCH_UDC_DMA_LAST)
>> +			    = PCH_UDC_DMA_LAST) {
>
>   But why not simply:
>
> 			if (td_data->status & PCH_UDC_DMA_LAST)
>
> if the constant is single bit anyway? And are you sure about s/td/td_data/?

Oops, thanks for noticing that.  I'll send a corrected version.

thanks,
julia

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
  2012-06-06 21:41   ` Julia Lawall
@ 2012-06-07 14:24     ` Jeff Moyer
  -1 siblings, 0 replies; 49+ messages in thread
From: Jeff Moyer @ 2012-06-07 14:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Alexander Viro, kernel-janitors, linux-fsdevel, linux-kernel,
	joe, Julia Lawall

Julia Lawall <Julia.Lawall@lip6.fr> writes:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> READ is 0, so the result of the bit-and operation is 0.  Rewrite with == as
> done elsewhere in the same file.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Interesting catch, that one.  Yeah, we don't expect any readahead I/O to
be done via O_DIRECT.  The test for rw == READ all over that file seems
fine to me, given that.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 4/7] fs/direct-io.c: adjust suspicious bit operation
@ 2012-06-07 14:24     ` Jeff Moyer
  0 siblings, 0 replies; 49+ messages in thread
From: Jeff Moyer @ 2012-06-07 14:24 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Alexander Viro, kernel-janitors, linux-fsdevel, linux-kernel,
	joe, Julia Lawall

Julia Lawall <Julia.Lawall@lip6.fr> writes:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> READ is 0, so the result of the bit-and operation is 0.  Rewrite with = as
> done elsewhere in the same file.
>
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Interesting catch, that one.  Yeah, we don't expect any readahead I/O to
be done via O_DIRECT.  The test for rw = READ all over that file seems
fine to me, given that.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-07 14:23       ` Julia Lawall
@ 2012-06-07 15:05         ` Joe Perches
  -1 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-07 15:05 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Thu, 2012-06-07 at 16:23 +0200, Julia Lawall wrote:
> Oops, thanks for noticing that.  I'll send a corrected version.

Hi Julia.

I should have let you know that I already submitted
a patch series for a simple treewide
"s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
https://lkml.org/lkml/2012/5/30/625

Felipe has already picked this patch up.
https://lkml.org/lkml/2012/6/1/83




^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-07 15:05         ` Joe Perches
  0 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-07 15:05 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Thu, 2012-06-07 at 16:23 +0200, Julia Lawall wrote:
> Oops, thanks for noticing that.  I'll send a corrected version.

Hi Julia.

I should have let you know that I already submitted
a patch series for a simple treewide
"s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
https://lkml.org/lkml/2012/5/30/625

Felipe has already picked this patch up.
https://lkml.org/lkml/2012/6/1/83




^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-06 21:41   ` Julia Lawall
@ 2012-06-07 21:46     ` David Miller
  -1 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-07 21:46 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe, julia

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed,  6 Jun 2012 23:41:35 +0200

> -	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
> +	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)

I'm really surprised someone as thorough as yourself did not
compile test this.

This is just more proof that it's absolutely pointless to make any
changes at all to the old IDE layer.  Nobody really cares, and the
risk %99.999 of the time is purely to introduce regressions rather
than make forward progress.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-07 21:46     ` David Miller
  0 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-07 21:46 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe, julia

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed,  6 Jun 2012 23:41:35 +0200

> -	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
> +	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)

I'm really surprised someone as thorough as yourself did not
compile test this.

This is just more proof that it's absolutely pointless to make any
changes at all to the old IDE layer.  Nobody really cares, and the
risk %99.999 of the time is purely to introduce regressions rather
than make forward progress.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-07 21:46     ` David Miller
@ 2012-06-07 21:59       ` Joe Perches
  -1 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-07 21:59 UTC (permalink / raw)
  To: David Miller
  Cc: Julia.Lawall, kernel-janitors, linux-ide, linux-kernel, julia

On Thu, 2012-06-07 at 14:46 -0700, David Miller wrote:
> the
> risk %99.999 of the time is purely to introduce regressions rather
> than make forward progress.

 MAINTAINERS |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b54f50c..41d4586 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3404,7 +3404,7 @@ M:	"David S. Miller" <davem@davemloft.net>
 L:	linux-ide@vger.kernel.org
 Q:	http://patchwork.ozlabs.org/project/linux-ide/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
-S:	Maintained
+S:	Watchdogged - Patch at your own peril
 F:	Documentation/ide/
 F:	drivers/ide/
 F:	include/linux/ide.h

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-07 21:59       ` Joe Perches
  0 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-07 21:59 UTC (permalink / raw)
  To: David Miller
  Cc: Julia.Lawall, kernel-janitors, linux-ide, linux-kernel, julia

On Thu, 2012-06-07 at 14:46 -0700, David Miller wrote:
> the
> risk %99.999 of the time is purely to introduce regressions rather
> than make forward progress.

 MAINTAINERS |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b54f50c..41d4586 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3404,7 +3404,7 @@ M:	"David S. Miller" <davem@davemloft.net>
 L:	linux-ide@vger.kernel.org
 Q:	http://patchwork.ozlabs.org/project/linux-ide/list/
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
-S:	Maintained
+S:	Watchdogged - Patch at your own peril
 F:	Documentation/ide/
 F:	drivers/ide/
 F:	include/linux/ide.h




^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-07 21:46     ` David Miller
@ 2012-06-08  5:12       ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-08  5:12 UTC (permalink / raw)
  To: David Miller
  Cc: Julia.Lawall, kernel-janitors, linux-ide, linux-kernel, joe, julia

On Thu, 7 Jun 2012, David Miller wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> Date: Wed,  6 Jun 2012 23:41:35 +0200
>
>> -	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
>> +	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)
>
> I'm really surprised someone as thorough as yourself did not
> compile test this.

Sorry, I changed the patch at the last minute, and it was indeed not a 
good idea not to have compiled again.  I will send another version, in 
case it is useful.

julia

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-08  5:12       ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-08  5:12 UTC (permalink / raw)
  To: David Miller
  Cc: Julia.Lawall, kernel-janitors, linux-ide, linux-kernel, joe, julia

On Thu, 7 Jun 2012, David Miller wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> Date: Wed,  6 Jun 2012 23:41:35 +0200
>
>> -	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
>> +	if ((p1dev->resource[0]->flags & IO_DATA_PATH_WIDTH)
>
> I'm really surprised someone as thorough as yourself did not
> compile test this.

Sorry, I changed the patch at the last minute, and it was indeed not a 
good idea not to have compiled again.  I will send another version, in 
case it is useful.

julia

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-07 21:46     ` David Miller
@ 2012-06-08  5:14       ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-08  5:14 UTC (permalink / raw)
  To: David Miller; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

>From nobody Wed Jun  6 21:48:37 CEST 2012
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-ide@vger.kernel.org,linux-kernel@vger.kernel.org,joe@perches.com
Subject: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
  drivers/ide/ide-cs.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..f1e922e 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
  {
  	int *is_kme = priv_data;

-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
  		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
  		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
  	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-08  5:14       ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-08  5:14 UTC (permalink / raw)
  To: David Miller; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From nobody Wed Jun  6 21:48:37 CEST 2012
From: Julia Lawall <Julia.Lawall@lip6.fr>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-ide@vger.kernel.org,linux-kernel@vger.kernel.org,joe@perches.com
Subject: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <julia@diku.dk>

---
  drivers/ide/ide-cs.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..f1e922e 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
  {
  	int *is_kme = priv_data;

-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
  		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
  		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
  	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-08  5:14       ` Julia Lawall
@ 2012-06-08  7:30         ` walter harms
  -1 siblings, 0 replies; 49+ messages in thread
From: walter harms @ 2012-06-08  7:30 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-ide



Am 08.06.2012 07:14, schrieb Julia Lawall:
>> From nobody Wed Jun  6 21:48:37 CEST 2012
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> To: "David S. Miller" <davem@davemloft.net>
> Cc: linux-ide@vger.kernel.org,linux-kernel@vger.kernel.org,joe@perches.com
> Subject: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
> value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
> first pick those bits and then make the test using !=.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/ide/ide-cs.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
> index 28e344e..f1e922e 100644
> --- a/drivers/ide/ide-cs.c
> +++ b/drivers/ide/ide-cs.c
> @@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct
> pcmcia_device *pdev, void *priv_data)
>  {
>      int *is_kme = priv_data;
> 
> -    if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
> +    if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
> +        != IO_DATA_PATH_WIDTH_8) {
>          pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
>          pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
>      }
> -- 

please patch until it is removed from the kernel code.
this will make checks happy and as fact of life such bug tend to show up
on surprising unpleasant times.

re,
 wh

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-08  7:30         ` walter harms
  0 siblings, 0 replies; 49+ messages in thread
From: walter harms @ 2012-06-08  7:30 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-ide



Am 08.06.2012 07:14, schrieb Julia Lawall:
>> From nobody Wed Jun  6 21:48:37 CEST 2012
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> To: "David S. Miller" <davem@davemloft.net>
> Cc: linux-ide@vger.kernel.org,linux-kernel@vger.kernel.org,joe@perches.com
> Subject: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
> value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
> first pick those bits and then make the test using !=.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <julia@diku.dk>
> 
> ---
>  drivers/ide/ide-cs.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
> index 28e344e..f1e922e 100644
> --- a/drivers/ide/ide-cs.c
> +++ b/drivers/ide/ide-cs.c
> @@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct
> pcmcia_device *pdev, void *priv_data)
>  {
>      int *is_kme = priv_data;
> 
> -    if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
> +    if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
> +        != IO_DATA_PATH_WIDTH_8) {
>          pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
>          pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
>      }
> -- 

please patch until it is removed from the kernel code.
this will make checks happy and as fact of life such bug tend to show up
on surprising unpleasant times.

re,
 wh

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-07 15:05         ` Joe Perches
@ 2012-06-08 12:58           ` Dan Carpenter
  -1 siblings, 0 replies; 49+ messages in thread
From: Dan Carpenter @ 2012-06-08 12:58 UTC (permalink / raw)
  To: Joe Perches
  Cc: Julia Lawall, Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Thu, Jun 07, 2012 at 08:05:44AM -0700, Joe Perches wrote:
> On Thu, 2012-06-07 at 16:23 +0200, Julia Lawall wrote:
> > Oops, thanks for noticing that.  I'll send a corrected version.
> 
> Hi Julia.
> 
> I should have let you know that I already submitted
> a patch series for a simple treewide
> "s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
> https://lkml.org/lkml/2012/5/30/625
> 

You could CC them to kernel-janitors@vger.kernel.org.  Julia and I
used to tread on each other's toes until we hijacked the k-j list.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-08 12:58           ` Dan Carpenter
  0 siblings, 0 replies; 49+ messages in thread
From: Dan Carpenter @ 2012-06-08 12:58 UTC (permalink / raw)
  To: Joe Perches
  Cc: Julia Lawall, Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Thu, Jun 07, 2012 at 08:05:44AM -0700, Joe Perches wrote:
> On Thu, 2012-06-07 at 16:23 +0200, Julia Lawall wrote:
> > Oops, thanks for noticing that.  I'll send a corrected version.
> 
> Hi Julia.
> 
> I should have let you know that I already submitted
> a patch series for a simple treewide
> "s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
> https://lkml.org/lkml/2012/5/30/625
> 

You could CC them to kernel-janitors@vger.kernel.org.  Julia and I
used to tread on each other's toes until we hijacked the k-j list.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
  2012-06-08 12:58           ` Dan Carpenter
@ 2012-06-08 15:28             ` Joe Perches
  -1 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-08 15:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Julia Lawall, Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Fri, 2012-06-08 at 15:58 +0300, Dan Carpenter wrote:
> On Thu, Jun 07, 2012 at 08:05:44AM -0700, Joe Perches wrote:
> > I should have let you know that I already submitted
> > a patch series for a simple treewide
> > "s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
> > https://lkml.org/lkml/2012/5/30/625
> You could CC them to kernel-janitors@vger.kernel.org.

Hi Dan,

Generally I submit patches to maintainers.
All of these 4 patches were picked up by them.

cheers, Joe


^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 3/7] drivers/usb/gadget/pch_udc.c: adjust suspicious bit operation
@ 2012-06-08 15:28             ` Joe Perches
  0 siblings, 0 replies; 49+ messages in thread
From: Joe Perches @ 2012-06-08 15:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Julia Lawall, Sergei Shtylyov, Felipe Balbi, kernel-janitors,
	Greg Kroah-Hartman, linux-usb, linux-kernel, Julia Lawall

On Fri, 2012-06-08 at 15:58 +0300, Dan Carpenter wrote:
> On Thu, Jun 07, 2012 at 08:05:44AM -0700, Joe Perches wrote:
> > I should have let you know that I already submitted
> > a patch series for a simple treewide
> > "s/if (value | UC_CONSTANT)/if (value & UC_CONSTANT)/"
> > https://lkml.org/lkml/2012/5/30/625
> You could CC them to kernel-janitors@vger.kernel.org.

Hi Dan,

Generally I submit patches to maintainers.
All of these 4 patches were picked up by them.

cheers, Joe


^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-08  5:14       ` Julia Lawall
@ 2012-06-11 23:43         ` David Miller
  -1 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-11 23:43 UTC (permalink / raw)
  To: julia.lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <julia.lawall@lip6.fr>
Date: Fri, 8 Jun 2012 07:14:03 +0200 (CEST)

> @@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct
> pcmcia_device *pdev, void *priv_data)

Patch mangled by your email client or similar.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-11 23:43         ` David Miller
  0 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-11 23:43 UTC (permalink / raw)
  To: julia.lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <julia.lawall@lip6.fr>
Date: Fri, 8 Jun 2012 07:14:03 +0200 (CEST)

> @@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct
> pcmcia_device *pdev, void *priv_data)

Patch mangled by your email client or similar.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-11 23:43         ` David Miller
@ 2012-06-12 14:17           ` Julia Lawall
  -1 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-12 14:17 UTC (permalink / raw)
  To: David Miller; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
I hope to have fixed the mail client problem.

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..f1e922e 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;

-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-12 14:17           ` Julia Lawall
  0 siblings, 0 replies; 49+ messages in thread
From: Julia Lawall @ 2012-06-12 14:17 UTC (permalink / raw)
  To: David Miller; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <Julia.Lawall@lip6.fr>

IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
first pick those bits and then make the test using !=.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
I hope to have fixed the mail client problem.

diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c
index 28e344e..f1e922e 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -167,7 +167,8 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, void *priv_data)
 {
 	int *is_kme = priv_data;

-	if (!(pdev->resource[0]->flags & IO_DATA_PATH_WIDTH_8)) {
+	if ((pdev->resource[0]->flags & IO_DATA_PATH_WIDTH)
+	    != IO_DATA_PATH_WIDTH_8) {
 		pdev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
 		pdev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
 	}

^ permalink raw reply related	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
  2012-06-12 14:17           ` Julia Lawall
@ 2012-06-12 22:52             ` David Miller
  -1 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-12 22:52 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Tue, 12 Jun 2012 10:17:25 -0400 (EDT)

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
> value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
> first pick those bits and then make the test using !=.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thanks.

^ permalink raw reply	[flat|nested] 49+ messages in thread

* Re: [PATCH 1/7] drivers/ide/ide-cs.c: adjust suspicious bit operation
@ 2012-06-12 22:52             ` David Miller
  0 siblings, 0 replies; 49+ messages in thread
From: David Miller @ 2012-06-12 22:52 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: kernel-janitors, linux-ide, linux-kernel, joe

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Tue, 12 Jun 2012 10:17:25 -0400 (EDT)

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> IO_DATA_PATH_WIDTH_8 is 0, so a bit-and with it is always false.  The
> value IO_DATA_PATH_WIDTH covers the bits of the IO_DATA_PATH constants, so
> first pick those bits and then make the test using !=.
> 
> This problem was found using Coccinelle (http://coccinelle.lip6.fr/).
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thanks.

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2012-06-12 22:52 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 21:41 [PATCH 0/7] adjust suspicious bit operation Julia Lawall
2012-06-06 21:41 ` Julia Lawall
2012-06-06 21:41 ` [PATCH 1/7] drivers/ide/ide-cs.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-07 21:46   ` David Miller
2012-06-07 21:46     ` David Miller
2012-06-07 21:59     ` Joe Perches
2012-06-07 21:59       ` Joe Perches
2012-06-08  5:12     ` Julia Lawall
2012-06-08  5:12       ` Julia Lawall
2012-06-08  5:14     ` Julia Lawall
2012-06-08  5:14       ` Julia Lawall
2012-06-08  7:30       ` walter harms
2012-06-08  7:30         ` walter harms
2012-06-11 23:43       ` David Miller
2012-06-11 23:43         ` David Miller
2012-06-12 14:17         ` Julia Lawall
2012-06-12 14:17           ` Julia Lawall
2012-06-12 22:52           ` David Miller
2012-06-12 22:52             ` David Miller
2012-06-06 21:41 ` [PATCH 2/7] drivers/staging/comedi/drivers/me4000.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-06 21:41 ` [PATCH 3/7] drivers/usb/gadget/pch_udc.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-07 13:00   ` Sergei Shtylyov
2012-06-07 13:00     ` Sergei Shtylyov
2012-06-07 14:23     ` Julia Lawall
2012-06-07 14:23       ` Julia Lawall
2012-06-07 15:05       ` Joe Perches
2012-06-07 15:05         ` Joe Perches
2012-06-08 12:58         ` Dan Carpenter
2012-06-08 12:58           ` Dan Carpenter
2012-06-08 15:28           ` Joe Perches
2012-06-08 15:28             ` Joe Perches
2012-06-06 21:41 ` [PATCH 4/7] fs/direct-io.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-07 14:24   ` Jeff Moyer
2012-06-07 14:24     ` Jeff Moyer
2012-06-06 21:41 ` [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-06 23:43   ` Franky Lin
2012-06-06 23:43     ` [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit Franky Lin
2012-06-06 23:43     ` [PATCH 5/7] drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c: adjust suspicious bit operation Franky Lin
2012-06-06 21:41 ` [PATCH 6/7] drivers/ata/pata_pcmcia.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-06 21:41 ` [PATCH 7/7] drivers/net/can/cc770/cc770_platform.c: " Julia Lawall
2012-06-06 21:41   ` Julia Lawall
2012-06-06 21:52   ` Marc Kleine-Budde
2012-06-06 21:52     ` Marc Kleine-Budde

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.