Skip to content

Commit

Permalink
airo: prevent potential underflow in airo_set_freq()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  • Loading branch information
Dan Carpenter authored and Kalle Valo committed May 11, 2016
1 parent 50d4d8f commit 03ba4a1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/wireless/cisco/airo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 03ba4a1

Please sign in to comment.