From 03ba4a1b718e3a018f38f1ee030de4cd052bb3f3 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 10 May 2016 22:20:37 +0300 Subject: [PATCH] airo: prevent potential underflow in airo_set_freq() 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 Signed-off-by: Kalle Valo --- drivers/net/wireless/cisco/airo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c index 4bd9e2b97e86..833b46c5ed42 100644 --- a/drivers/net/wireless/cisco/airo.c +++ b/drivers/net/wireless/cisco/airo.c @@ -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; -- 2.30.2