2014-12-10 09:23:31

by Henning Rogge

[permalink] [raw]
Subject: [PATCH] iw: Fix calculation of maximum supported 802.11n data rate

Fix typo in calculation, binary AND combination of low byte
and high byte is always zero.

Signed-off-by: Henning Rogge <[email protected]>
---
util.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index ce4b0ac..c61955c 100644
--- a/util.c
+++ b/util.c
@@ -594,7 +594,7 @@ void print_ht_mcs(const __u8 *mcs)
unsigned int tx_max_num_spatial_streams, max_rx_supp_data_rate;
bool tx_mcs_set_defined, tx_mcs_set_equal, tx_unequal_modulation;

- max_rx_supp_data_rate = (mcs[10] & ((mcs[11] & 0x3) << 8));
+ max_rx_supp_data_rate = (mcs[10] | ((mcs[11] & 0x3) << 8));
tx_mcs_set_defined = !!(mcs[12] & (1 << 0));
tx_mcs_set_equal = !(mcs[12] & (1 << 1));
tx_max_num_spatial_streams = ((mcs[12] >> 2) & 3) + 1;
--
1.9.3



2014-12-12 11:07:43

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] iw: Fix calculation of maximum supported 802.11n data rate

On Wed, 2014-12-10 at 10:23 +0100, Henning Rogge wrote:
> Fix typo in calculation, binary AND combination of low byte
> and high byte is always zero.

Obviously - applied, thanks.

johannes


2014-12-12 13:22:33

by Henning Rogge

[permalink] [raw]
Subject: Re: [PATCH] iw: Fix calculation of maximum supported 802.11n data rate

Hi,

the bug was caught by Coverity (I use parts of the "iw" code in a
different project to talk to nl802.11).

Maybe it would be interesting to register the "iw" project with Coverity.

Henning

On Fri, Dec 12, 2014 at 12:07 PM, Johannes Berg
<[email protected]> wrote:
> On Wed, 2014-12-10 at 10:23 +0100, Henning Rogge wrote:
>> Fix typo in calculation, binary AND combination of low byte
>> and high byte is always zero.
>
> Obviously - applied, thanks.
>
> johannes
>