Skip to contentSkip to conversation

mwifiex: fix potential out-of-boundary access to ibss rate table

PATCH New Bing Zhao 1 participant 1 message Mar 8, 2013 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 mwifiex: fix potential out-of-boundary access to ibss rate table

smatch found this error:

CHECK drivers/net/wireless/mwifiex/join.c
drivers/net/wireless/mwifiex/join.c:1121
mwifiex_cmd_802_11_ad_hoc_join()
error: testing array offset 'i' after use.

---
 drivers/net/wireless/mwifiex/join.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/mwifiex/join.c +3 -4
index 246aa62..2fe0ceb 100644
@@ -1117,10 +1117,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
 		adhoc_join->bss_descriptor.bssid,
 		adhoc_join->bss_descriptor.ssid);
 
-	for (i = 0; bss_desc->supported_rates[i] &&
-			i < MWIFIEX_SUPPORTED_RATES;
-			i++)
-			;
+	for (i = 0; i < MWIFIEX_SUPPORTED_RATES &&
+		    bss_desc->supported_rates[i]; i++)
+		;
 	rates_size = i;
 
 	/* Copy Data Rates from the Rates recorded in scan response */
Signature · 1 line
1.7.0.2