Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1442299 > unrolled thread
| Started by | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| First post | 2016-07-13 12:20 +0200 |
| Last post | 2016-07-13 17:10 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[patch] dsp56k: prevent a harmless underflow Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-13 12:20 +0200
Re: [patch] dsp56k: prevent a harmless underflow Arnd Bergmann <arnd@arndb.de> - 2016-07-13 17:10 +0200
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2016-07-13 12:20 +0200 |
| Subject | [patch] dsp56k: prevent a harmless underflow |
| Message-ID | <rUpqO-1JD-19@gated-at.bofh.it> |
There is a mistake here where we don't allow "len" to be zero but we
allow negative lengths. It's basically harmless in this case, but the
underflow makes my static checker complain.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 8bf70e8..50aa9ba 100644
--- a/drivers/char/dsp56k.c
+++ b/drivers/char/dsp56k.c
@@ -325,7 +325,7 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd,
if(get_user(bin, &binary->bin) < 0)
return -EFAULT;
- if (len == 0) {
+ if (len <= 0) {
return -EINVAL; /* nothing to upload?!? */
}
if (len > DSP56K_MAX_BINARY_LENGTH) {
[toc] | [next] | [standalone]
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-07-13 17:10 +0200 |
| Message-ID | <rUtXs-4Ju-29@gated-at.bofh.it> |
| In reply to | #1442299 |
On Wednesday, July 13, 2016 1:11:19 PM CEST Dan Carpenter wrote: > There is a mistake here where we don't allow "len" to be zero but we > allow negative lengths. It's basically harmless in this case, but the > underflow makes my static checker complain. > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > Reviewed-by: Arnd Bergmann <arnd@arndb.de>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web