atmel: potential underflow in atmel_set_freq()
PATCH 1/1 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 <[email protected]>
drivers/net/wireless/atmel/atmel.c +1 -1
@@ -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;
Quoted 5 lines · Dan Carpenter
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 <[email protected]>
Thanks, 1 patch applied to wireless-drivers-next.git:
d9739a26fbca atmel: potential underflow in atmel_set_freq()
Signature · 2 lines
Sent by pwcli https://patchwork.kernel.org/patch/9061371/