diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-10-09 00:39:30 (GMT) |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-10-11 19:04:21 (GMT) |
commit | cac4220b2e93e6344f987581d52d5bd71ff2cc0e (patch) | |
tree | d089cca561a5fe1237a1f2a80589c7819ed3abe8 /drivers/net/wireless/ath/ath9k/init.c | |
parent | 8610c29a2c9f273886b1c31ae4d92c69d4326262 (diff) | |
download | linux-fsl-qoriq-cac4220b2e93e6344f987581d52d5bd71ff2cc0e.tar.xz |
ath9k: add compile time checking for the size of the channel list
This prevents random memory corruption if the number of channels ever gets
changed without an update to the internal channel array size.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k/init.c')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index d76003c..a4c5ed4 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c @@ -481,6 +481,10 @@ static int ath9k_init_channels_rates(struct ath_softc *sc) { void *channels; + BUILD_BUG_ON(ARRAY_SIZE(ath9k_2ghz_chantable) + + ARRAY_SIZE(ath9k_5ghz_chantable) != + ATH9K_NUM_CHANNELS); + if (test_bit(ATH9K_MODE_11G, sc->sc_ah->caps.wireless_modes)) { channels = kmemdup(ath9k_2ghz_chantable, sizeof(ath9k_2ghz_chantable), GFP_KERNEL); |