diff options
-rw-r--r-- | drivers/net/wireless/b43/main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 345ac3862e11..a15a45b789b1 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -1163,7 +1163,7 @@ static void b43_write_beacon_template(struct b43_wldev *dev, | |||
1163 | u16 ram_offset, | 1163 | u16 ram_offset, |
1164 | u16 shm_size_offset, u8 rate) | 1164 | u16 shm_size_offset, u8 rate) |
1165 | { | 1165 | { |
1166 | int i, len; | 1166 | unsigned int i, len, variable_len; |
1167 | const struct ieee80211_mgmt *bcn; | 1167 | const struct ieee80211_mgmt *bcn; |
1168 | const u8 *ie; | 1168 | const u8 *ie; |
1169 | bool tim_found = 0; | 1169 | bool tim_found = 0; |
@@ -1178,7 +1178,8 @@ static void b43_write_beacon_template(struct b43_wldev *dev, | |||
1178 | /* Find the position of the TIM and the DTIM_period value | 1178 | /* Find the position of the TIM and the DTIM_period value |
1179 | * and write them to SHM. */ | 1179 | * and write them to SHM. */ |
1180 | ie = bcn->u.beacon.variable; | 1180 | ie = bcn->u.beacon.variable; |
1181 | for (i = 0; i < len - 2; ) { | 1181 | variable_len = len - offsetof(struct ieee80211_mgmt, u.beacon.variable); |
1182 | for (i = 0; i < variable_len - 2; ) { | ||
1182 | uint8_t ie_id, ie_len; | 1183 | uint8_t ie_id, ie_len; |
1183 | 1184 | ||
1184 | ie_id = ie[i]; | 1185 | ie_id = ie[i]; |
@@ -1189,7 +1190,7 @@ static void b43_write_beacon_template(struct b43_wldev *dev, | |||
1189 | /* This is the TIM Information Element */ | 1190 | /* This is the TIM Information Element */ |
1190 | 1191 | ||
1191 | /* Check whether the ie_len is in the beacon data range. */ | 1192 | /* Check whether the ie_len is in the beacon data range. */ |
1192 | if (len < ie_len + 2 + i) | 1193 | if (variable_len < ie_len + 2 + i) |
1193 | break; | 1194 | break; |
1194 | /* A valid TIM is at least 4 bytes long. */ | 1195 | /* A valid TIM is at least 4 bytes long. */ |
1195 | if (ie_len < 4) | 1196 | if (ie_len < 4) |