aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-07-13 13:11:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-07-14 16:21:53 +0900
commit241903641111803807c90016866d88d7ef8c9347 (patch)
tree72e0cca7c435845b29b019965cb27b49173369f7 /drivers/char
parentchardev: add missing line break in pr_warn (diff)
downloadlinux-dev-241903641111803807c90016866d88d7ef8c9347.tar.xz
linux-dev-241903641111803807c90016866d88d7ef8c9347.zip
dsp56k: prevent a harmless underflow
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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/dsp56k.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/char/dsp56k.c b/drivers/char/dsp56k.c
index 8bf70e8c3f79..50aa9ba91f25 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) {