mirror of
https://github.com/torvalds/linux
synced 2024-09-20 19:17:24 +00:00
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>
This commit is contained in:
parent
077e2642fb
commit
2419036411
|
@ -325,7 +325,7 @@ static long dsp56k_ioctl(struct file *file, unsigned int cmd,
|
||||||
if(get_user(bin, &binary->bin) < 0)
|
if(get_user(bin, &binary->bin) < 0)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (len == 0) {
|
if (len <= 0) {
|
||||||
return -EINVAL; /* nothing to upload?!? */
|
return -EINVAL; /* nothing to upload?!? */
|
||||||
}
|
}
|
||||||
if (len > DSP56K_MAX_BINARY_LENGTH) {
|
if (len > DSP56K_MAX_BINARY_LENGTH) {
|
||||||
|
|
Loading…
Reference in a new issue