Skip to contentSkip to conversation

net/hamradio: fix test in receive()

PATCH Applied Roel Kluin 3 participants 3 messages Oct 6, 2009 – Oct 14, 2009

Subsystems (2)
lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 net/hamradio: fix test in receive()

The negation makes it a bool before the comparison and hence it will never evaluate to true.

---
Was this intended?

drivers/net/hamradio/baycom_epp.c +2 -1
index 7bcaf7c..ee06a13 100644
@@ -596,7 +596,8 @@ static int receive(struct net_device *dev, int cnt)
 						state = 0;
 
 					/* not flag received */
-					else if (!(bitstream & (0x1fe << j)) != (0x0fc << j)) {
+					else if ((bitstream & (0x1fe << j)) !=
+							(0x0fc << j)) {
 						if (state)
 							do_rxpacket(dev);
 						bc->hdlcrx.bufcnt = 0;
#2 lore raw
In reply to Roel Kluin
Quoted 12 lines · On Tue, 06 Oct 2009 13:20:08 +0200 Roel Kluin <[email protected]> wrote:

The negation makes it a bool before the comparison and hence it will never evaluate to true.

---
Was this intended?

drivers/net/hamradio/baycom_epp.c +0 -0
index 7bcaf7c..ee06a13 100644

drivers/net/hamradio/baycom_epp.c static int receive(struct net_device *dev, int cnt) · line 603

Quoted 9 lines
drivers/net/hamradio/baycom_epp.c +2 -1
@@ -596,7 +596,8 @@ static int receive(struct net_device *dev, int cnt)
 						state = 0;
 
 					/* not flag received */
-					else if (!(bitstream & (0x1fe << j)) != (0x0fc << j)) {
+					else if ((bitstream & (0x1fe << j)) !=
+							(0x0fc << j)) {
 						if (state)
 							do_rxpacket(dev);
 						bc->hdlcrx.bufcnt = 0;

It does look like that is what was intended.

With this fix we're turning on a code path which probably hasn't been executed by anyone in a decade or so. I wonder what it'll do?