atmel: potential underflow in atmel_set_freq()
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 10 May 2016 19:21:17 +0000 (22:21 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 11 May 2016 19:02:20 +0000 (22:02 +0300)
Smatch complains that we cap the upper bound of "fwrq->m" but not the
lower bound.  I don't know if it can actually happen but it's simple
enough to check for negatives.

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

index 8f8f37f3a00c3314936edfe0295346f5c695f642..bf2e9a083c0c31be65dc3f5c33e5a71f0015b1d3 100644 (file)
@@ -2275,7 +2275,7 @@ static int atmel_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;
This page took 0.026803 seconds and 5 git commands to generate.