linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] airo: prevent potential underflow in airo_set_freq()
@ 2016-05-10 19:20 Dan Carpenter
  2016-05-11 19:02 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2016-05-10 19:20 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Ondrej Zary, Florian Westphal, David S. Miller, Felipe Balbi,
	Andy Shevchenko, Johannes Berg, linux-wireless, kernel-janitors

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>

diff --git a/drivers/net/wireless/cisco/airo.c b/drivers/net/wireless/cisco/airo.c
index 55456f7..ca3cd21 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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: airo: prevent potential underflow in airo_set_freq()
  2016-05-10 19:20 [patch] airo: prevent potential underflow in airo_set_freq() Dan Carpenter
@ 2016-05-11 19:02 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2016-05-11 19:02 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ondrej Zary, Florian Westphal, David S. Miller, Felipe Balbi,
	Andy Shevchenko, Johannes Berg, linux-wireless, kernel-janitors

Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 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>

Thanks, 1 patch applied to wireless-drivers-next.git:

03ba4a1b718e airo: prevent potential underflow in airo_set_freq()

-- 
Sent by pwcli
https://patchwork.kernel.org/patch/9061381/


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-11 19:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-10 19:20 [patch] airo: prevent potential underflow in airo_set_freq() Dan Carpenter
2016-05-11 19:02 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).