diff mbox

net/hamradio: fix test in receive()

Message ID 4ACB27E8.8060401@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

roel kluin Oct. 6, 2009, 11:20 a.m. UTC
The negation makes it a bool before the comparison and hence it
will never evaluate to true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Was this intended?

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

Comments

David Miller Oct. 13, 2009, 10:47 a.m. UTC | #1
From: Roel Kluin <roel.kluin@gmail.com>
Date: Tue, 06 Oct 2009 13:20:08 +0200

> The negation makes it a bool before the comparison and hence it
> will never evaluate to true.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>

Applied to net-next-2.6, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andrew Morton Oct. 14, 2009, 2:10 a.m. UTC | #2
On Tue, 06 Oct 2009 13:20:08 +0200 Roel Kluin <roel.kluin@gmail.com> wrote:

> The negation makes it a bool before the comparison and hence it
> will never evaluate to true.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Was this intended?
> 
> diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
> index 7bcaf7c..ee06a13 100644
> --- a/drivers/net/hamradio/baycom_epp.c
> +++ b/drivers/net/hamradio/baycom_epp.c
> @@ -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?

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c
index 7bcaf7c..ee06a13 100644
--- a/drivers/net/hamradio/baycom_epp.c
+++ b/drivers/net/hamradio/baycom_epp.c
@@ -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;