airo: prevent potential underflow in airo_set_freq()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 10 May 2016 19:20:37 +0000 (22:20 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 11 May 2016 19:01:38 +0000 (22:01 +0300)
I'm not sure if this can underflow but Smatch complains.  It seems
harmless to add a check for negatives.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/cisco/airo.c

index 4bd9e2b97e860e6e02e0bca0a98986d4bc80eb3d..833b46c5ed42b5c5d8c7d91048995973998a30a3 100644 (file)
@@ -5794,7 +5794,7 @@ static int airo_set_freq(struct net_device *dev,
                fwrq->m = ieee80211_frequency_to_channel(f);
        }
        /* Setting by channel number */
-       if((fwrq->m > 1000) || (fwrq->e > 0))
+       if (fwrq->m < 0 || fwrq->m > 1000 || fwrq->e > 0)
                rc = -EOPNOTSUPP;
        else {
                int channel = fwrq->m;