netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/hamradio: fix test in receive()
@ 2009-10-06 11:20 Roel Kluin
  2009-10-13 10:47 ` David Miller
  2009-10-14  2:10 ` Andrew Morton
  0 siblings, 2 replies; 3+ messages in thread
From: Roel Kluin @ 2009-10-06 11:20 UTC (permalink / raw)
  To: netdev, davem, Andrew Morton

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;

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

* Re: [PATCH] net/hamradio: fix test in receive()
  2009-10-06 11:20 [PATCH] net/hamradio: fix test in receive() Roel Kluin
@ 2009-10-13 10:47 ` David Miller
  2009-10-14  2:10 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2009-10-13 10:47 UTC (permalink / raw)
  To: roel.kluin; +Cc: netdev, akpm

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.

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

* Re: [PATCH] net/hamradio: fix test in receive()
  2009-10-06 11:20 [PATCH] net/hamradio: fix test in receive() Roel Kluin
  2009-10-13 10:47 ` David Miller
@ 2009-10-14  2:10 ` Andrew Morton
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2009-10-14  2:10 UTC (permalink / raw)
  To: Roel Kluin; +Cc: netdev, davem, Thomas Sailer

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?


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

end of thread, other threads:[~2009-10-14  2:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-06 11:20 [PATCH] net/hamradio: fix test in receive() Roel Kluin
2009-10-13 10:47 ` David Miller
2009-10-14  2:10 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).