diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-01-21 09:13:48 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 16:01:09 -0500 |
commit | 881d948c23442173a011f1adcfe4c95bf7f27515 (patch) | |
tree | 3d7e6a4bf23b960cf45a4d2c5734578168ce0424 /net/wireless/core.c | |
parent | 369391db1aabd089cefaadaabb6d9fc82e78b0a7 (diff) |
wireless: restrict to 32 legacy rates
Since the standards only define 12 legacy rates, 32 is certainly
a sane upper limit and we don't need to use u64 everywhere. Add
sanity checking that no more than 32 rates are registered and
change the variables to u32 throughout.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index b96fc0c3f1c4..125226476089 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -273,10 +273,16 @@ int wiphy_register(struct wiphy *wiphy) | |||
273 | 273 | ||
274 | sband->band = band; | 274 | sband->band = band; |
275 | 275 | ||
276 | if (!sband->n_channels || !sband->n_bitrates) { | 276 | if (WARN_ON(!sband->n_channels || !sband->n_bitrates)) |
277 | WARN_ON(1); | 277 | return -EINVAL; |
278 | |||
279 | /* | ||
280 | * Since we use a u32 for rate bitmaps in | ||
281 | * ieee80211_get_response_rate, we cannot | ||
282 | * have more than 32 legacy rates. | ||
283 | */ | ||
284 | if (WARN_ON(sband->n_bitrates > 32)) | ||
278 | return -EINVAL; | 285 | return -EINVAL; |
279 | } | ||
280 | 286 | ||
281 | for (i = 0; i < sband->n_channels; i++) { | 287 | for (i = 0; i < sband->n_channels; i++) { |
282 | sband->channels[i].orig_flags = | 288 | sband->channels[i].orig_flags = |