Skip to contentSkip to conversation

dsp56k: prevent a harmless underflow

PATCH In review Dan Carpenter 2 participants 2 messages Jul 13, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

drivers/char/dsp56k.c +1 -1
index 8bf70e8..50aa9ba 100644
@@ -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) {