Skip to contentSkip to conversation

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

DISCUSSION Roel Kluin 3 participants 4 messages Mar 9, 2008 – Mar 10, 2008

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

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

#1 lore raw
Quoted 8 lines · --- Roel Kluin

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

author
#2 lore raw
Quoted 11 lines · Paul Gortmaker
Quoted 8 lines · --- Roel Kluin

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

Quoted 8 lines

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

---

drivers/net/tokenring/smctr.c +1 -1
index 8909050..8ae5837 100644
@@ -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;
#3 lore raw

drivers/net/tokenring/smctr.c static int smctr_make_tx_status_code(struct net_device *dev, · line 3419

Quoted 13 lines · Roel Kluin
drivers/net/tokenring/smctr.c +1 -1
index 8909050..8ae5837 100644
@@ -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.