Skip to contentSkip to conversation

iw: Fix calculation of maximum supported 802.11n data rate

PATCH In review Henning Rogge 2 participants 3 messages Dec 10, 2014 – Dec 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
util.c +1 -1
index ce4b0ac..c61955c 100644
@@ -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;
Signature · 1 line
1.9.3
#1 lore raw
Quoted 2 lines · Henning Rogge

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

Obviously - applied, thanks.

johannes

#2 lore raw

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

Quoted 8 lines · Johannes Berg
Quoted 2 lines · Henning Rogge

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

Obviously - applied, thanks.

johannes