]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
USB: cyberjack: fix buggy integer overflow test
authorDan Carpenter <dan.carpenter@oracle.com>
Sun, 6 Oct 2013 00:32:53 +0000 (03:32 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Oct 2013 07:07:18 +0000 (00:07 -0700)
"old_rdtodo" and "size" are short type.  They are type promoted to int
and the condition is never true.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/cyberjack.c

index 781426230d695a3f34544ab4b0a589a500a0063e..6e1b69d0f5f57da980f439a3643567ada4aec3b6 100644 (file)
@@ -279,7 +279,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
 
                old_rdtodo = priv->rdtodo;
 
-               if (old_rdtodo + size < old_rdtodo) {
+               if (old_rdtodo > SHRT_MAX - size) {
                        dev_dbg(dev, "To many bulk_in urbs to do.\n");
                        spin_unlock(&priv->lock);
                        goto resubmit;