Skip to content

Commit

Permalink
rndis_wlan: use ARRAY_SIZE instead of sizeof when adding 11g rates
Browse files Browse the repository at this point in the history
While figuring out the TKIP problem I found a bug in the code which adds the 11g
rates. It's using sizeof instead of ARRAY_SIZE to terminate the for loop. This makes
it fall off the end of the rates array start into the frequency array instead. Running
"iwlist rate" should show the problem as there will always be 32 rates with the last
few being bogus.

The following patch will fix it.

Signed-off-by: Scott Ashcroft <scott.ashcroft@talk21.com>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Scott Ashcroft authored and John W. Linville committed Jun 3, 2008
1 parent a888d52 commit 20ad4fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/rndis_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1108,7 +1108,7 @@ static int rndis_iw_get_range(struct net_device *dev,
/* fill in 802.11g rates */
if (has_80211g_rates) {
num = range->num_bitrates;
for (i = 0; i < sizeof(rates_80211g); i++) {
for (i = 0; i < ARRAY_SIZE(rates_80211g); i++) {
for (j = 0; j < num; j++) {
if (range->bitrate[j] ==
rates_80211g[i] * 1000000)
Expand Down

0 comments on commit 20ad4fd

Please sign in to comment.