Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1398438 > unrolled thread
| Started by | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| First post | 2016-05-10 21:30 +0200 |
| Last post | 2016-05-11 21:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[patch] atmel: potential underflow in atmel_set_freq() Dan Carpenter <dan.carpenter@oracle.com> - 2016-05-10 21:30 +0200
Re: atmel: potential underflow in atmel_set_freq() Kalle Valo <kvalo@codeaurora.org> - 2016-05-11 21:10 +0200
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-05-10 21:30 +0200 |
| Subject | [patch] atmel: potential underflow in atmel_set_freq() |
| Message-ID | <rxlvY-Gw-13@gated-at.bofh.it> |
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 <dan.carpenter@oracle.com>
diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c
index 8f8f37f..bf2e9a0 100644
--- a/drivers/net/wireless/atmel/atmel.c
+++ b/drivers/net/wireless/atmel/atmel.c
@@ -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;
[toc] | [next] | [standalone]
| From | Kalle Valo <kvalo@codeaurora.org> |
|---|---|
| Date | 2016-05-11 21:10 +0200 |
| Subject | Re: atmel: potential underflow in atmel_set_freq() |
| Message-ID | <rxHGa-6be-5@gated-at.bofh.it> |
| In reply to | #1398438 |
Dan Carpenter <dan.carpenter@oracle.com> wrote: > 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 <dan.carpenter@oracle.com> Thanks, 1 patch applied to wireless-drivers-next.git: d9739a26fbca atmel: potential underflow in atmel_set_freq() -- Sent by pwcli https://patchwork.kernel.org/patch/9061371/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web