Skip to contentSkip to conversation

rsi: Fixed errors and warnings reported by static code analyzers.

PATCH New Jahnavi Meher 1 participant 1 message Jun 25, 2014 Redpine wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rsi: Fixed errors and warnings reported by static code analyzers.

Fixed a potential buffer overflow in 'rsi_rates' and a sparse warning related to difference in endianness in rsi_91x_mgmt.c.

---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +3 -2
index 83abe58..8d110fd 100644
@@ -1055,7 +1055,8 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
 		rate_table_offset = 4;
 	}
 
-	for (ii = 0, jj = 0; ii < ARRAY_SIZE(rsi_rates); ii++) {
+	for (ii = 0, jj = 0;
+	     ii < (ARRAY_SIZE(rsi_rates) - rate_table_offset); ii++) {
 		if (rate_bitmap & BIT(ii)) {
 			selected_rates[jj++] =
 			(rsi_rates[ii + rate_table_offset].bitrate / 5);
@@ -1103,7 +1104,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common)
 	}
 
 	for (; ii < RSI_TBL_SZ; ii++)
-		auto_rate->supported_rates[ii] = min_rate;
+		auto_rate->supported_rates[ii] = cpu_to_le16(min_rate);
 
 	auto_rate->num_supported_rates = cpu_to_le16(num_supported_rates * 2);
 	auto_rate->moderate_rate_inx = cpu_to_le16(num_supported_rates / 2);
Signature · 1 line
1.7.1