Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] iw: fix incorrect bit shifting in print_ht_mcs
@ 2013-06-26 15:07 John W. Linville
  2013-06-26 15:24 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: John W. Linville @ 2013-06-26 15:07 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, John W. Linville

From: "John W. Linville" <linville@tuxdriver.com>

>From a Coverity run on version 3.10:

iw-3.10/util.c:569:result_independent_of_operands –
	"mcs[10] >> 8" is 0 regardless of the values of its operands. This occurs as the bitwise first operand of '&'.

This seems more like what was intended...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index d8b76ee..e3d0c27 100644
--- a/util.c
+++ b/util.c
@@ -574,7 +574,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] >> 8) & ((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.8.1.4


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

end of thread, other threads:[~2013-06-26 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-26 15:07 [PATCH] iw: fix incorrect bit shifting in print_ht_mcs John W. Linville
2013-06-26 15:24 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox