From: Dan Carpenter Date: Tue, 10 May 2016 19:20:37 +0000 (+0300) Subject: airo: prevent potential underflow in airo_set_freq() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=03ba4a1b718e3a018f38f1ee030de4cd052bb3f3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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;