netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Greear <greearb@candelatech.com>
To: Joe Perches <joe@perches.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	Johannes Berg <johannes@sipsolutions.net>,
	"David S. Miller" <davem@davemloft.net>,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] mac80211: Fix likely misuse of | for &
Date: Wed, 30 May 2012 13:29:42 -0700	[thread overview]
Message-ID: <4FC68336.3000806@candelatech.com> (raw)
In-Reply-To: <aa9c55edda55d38111660c0b250d12d79f6e1755.1338408931.git.joe@perches.com>

On 05/30/2012 01:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be&.

Yes, I think your change is correct.  Looks like something
a compiler or static analysis tool could catch and warn about...

Sorry for the bug!

Ben

>
> cc: Ben Greear<greearb@candelatech.com>
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
>   net/mac80211/cfg.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 495831e..e9cecca 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -533,16 +533,16 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
>   		sinfo.filled = 0;
>   		sta_set_sinfo(sta,&sinfo);
>
> -		if (sinfo.filled | STATION_INFO_TX_BITRATE)
> +		if (sinfo.filled&  STATION_INFO_TX_BITRATE)
>   			data[i] = 100000 *
>   				cfg80211_calculate_bitrate(&sinfo.txrate);
>   		i++;
> -		if (sinfo.filled | STATION_INFO_RX_BITRATE)
> +		if (sinfo.filled&  STATION_INFO_RX_BITRATE)
>   			data[i] = 100000 *
>   				cfg80211_calculate_bitrate(&sinfo.rxrate);
>   		i++;
>
> -		if (sinfo.filled | STATION_INFO_SIGNAL_AVG)
> +		if (sinfo.filled&  STATION_INFO_SIGNAL_AVG)
>   			data[i] = (u8)sinfo.signal_avg;
>   		i++;
>   	} else {


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com

  reply	other threads:[~2012-05-30 20:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-30 20:25 [PATCH 0/4] treewide: Fix likely misuses of | for & Joe Perches
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
2012-05-30 20:29   ` Ben Greear [this message]
2012-05-30 20:25 ` [PATCH 2/4] can: cc770: " Joe Perches
2012-05-31 20:54   ` Marc Kleine-Budde
2012-05-30 20:25 ` [PATCH 3/4] brcmfmac: " Joe Perches
2012-05-30 20:50   ` Arend van Spriel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FC68336.3000806@candelatech.com \
    --to=greearb@candelatech.com \
    --cc=davem@davemloft.net \
    --cc=joe@perches.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).