drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

4 messages, 3 authors, 2008-03-10 · open the first message on its own page

drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

From: Roel Kluin <hidden>
Date: 2008-03-09 21:44:00

drivers/net/tokenring/smctr.c:3416

tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);

shouldn't this be a bit-wise or?
from drivers/net/tokenring/smctr.h:50:

#define      IBM_PASS_SOURCE_ADDR    0x01

Re: drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

From: Paul Gortmaker <hidden>
Date: 2008-03-10 00:16:23

--- Roel Kluin <12o3l@tiscali.nl> wrote:
drivers/net/tokenring/smctr.c:3416

tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);

shouldn't this be a bit-wise or?
from drivers/net/tokenring/smctr.h:50:

#define      IBM_PASS_SOURCE_ADDR    0x01
Probably a safe bet that is what they meant to have. Since
as it stands, gcc will (correctly) optimize that into:

tsv->svv[0]= 1;

which probably isn't particularly useful.

Paul.
 



      Connect with friends from any web browser - no download required. Try the new Yahoo! Canada Messenger for the Web BETA at http://ca.messenger.yahoo.com/webmessengerpromo.php

Re: drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

From: Roel Kluin <hidden>
Date: 2008-03-10 01:16:40

Paul Gortmaker wrote:
quoted hunk
--- Roel Kluin <12o3l@tiscali.nl> wrote:
quoted
drivers/net/tokenring/smctr.c:3416

tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);

shouldn't this be a bit-wise or?
from drivers/net/tokenring/smctr.h:50:

#define      IBM_PASS_SOURCE_ADDR    0x01
Probably a safe bet that is what they meant to have. Since
as it stands, gcc will (correctly) optimize that into:

tsv->svv[0]= 1;

which probably isn't particularly useful.

Paul.
That was what I was thinking as well.
---
logical-bitwise | confusion

Signed-off-by: Roel Kluin <redacted>
---
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 8909050..8ae5837 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3413,7 +3413,7 @@ static int smctr_make_tx_status_code(struct net_device *dev,
         tsv->svi = TRANSMIT_STATUS_CODE;
         tsv->svl = S_TRANSMIT_STATUS_CODE;
 
-        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);
+        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) | IBM_PASS_SOURCE_ADDR);
 
         /* Stripped frame status of Transmitted Frame */
         tsv->svv[1] = tx_fstatus & 0xff;

Re: drivers/net/tokenring/smctr.c: logical-bitwise or confusion?

From: Joe Perches <joe@perches.com>
Date: 2008-03-10 01:29:04

On Mon, 2008-03-10 at 02:16 +0100, Roel Kluin wrote:
quoted hunk
diff --git a/drivers/net/tokenring/smctr.c b/drivers/net/tokenring/smctr.c
index 8909050..8ae5837 100644
--- a/drivers/net/tokenring/smctr.c
+++ b/drivers/net/tokenring/smctr.c
@@ -3413,7 +3413,7 @@ static int smctr_make_tx_status_code(struct net_device *dev,
         tsv->svi = TRANSMIT_STATUS_CODE;
         tsv->svl = S_TRANSMIT_STATUS_CODE;
 
-        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) || IBM_PASS_SOURCE_ADDR);
+        tsv->svv[0] = ((tx_fstatus & 0x0100 >> 6) | IBM_PASS_SOURCE_ADDR);
 
         /* Stripped frame status of Transmitted Frame */
         tsv->svv[1] = tx_fstatus & 0xff;
This has been posted a few times over the last 6 months.

for instance:
http://www.ussg.iu.edu/hypermail/linux/kernel/0710.1/0887.html

Somebody please apply it.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help