ath9k_hw: min_t() casts u32 to int
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 17 Oct 2011 07:28:23 +0000 (10:28 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Nov 2011 20:53:57 +0000 (15:53 -0500)
The code here treats very large values of "limit" as less than
MAX_POWER_RATE because of the cast to int.  We should do the compare
as u32 instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/hw.c

index f16d203..e1dc084 100644 (file)
@@ -2579,7 +2579,7 @@ void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit, bool test)
        struct ath9k_channel *chan = ah->curchan;
        struct ieee80211_channel *channel = chan->chan;
 
-       reg->power_limit = min_t(int, limit, MAX_RATE_POWER);
+       reg->power_limit = min_t(u32, limit, MAX_RATE_POWER);
        if (test)
                channel->max_power = MAX_RATE_POWER / 2;