summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-05-10 21:21:17 +0200
committerKalle Valo <kvalo@codeaurora.org>2016-05-11 21:02:20 +0200
commitd9739a26fbcaa11c026dd79bc310af96003f20d8 (patch)
tree115bc6a901896eae3e846dfd3728c032d2956992 /drivers/net/wireless
parentairo: prevent potential underflow in airo_set_freq() (diff)
downloadlinux-d9739a26fbcaa11c026dd79bc310af96003f20d8.tar.xz
linux-d9739a26fbcaa11c026dd79bc310af96003f20d8.zip
atmel: potential underflow in atmel_set_freq()
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>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/atmel/atmel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index 8f8f37f3a00c..bf2e9a083c0c 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -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;