]> git.hungrycats.org Git - linux/commitdiff
[PATCH] idmouse min() fix
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Wed, 2 Feb 2005 00:50:07 +0000 (16:50 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Wed, 2 Feb 2005 00:50:07 +0000 (16:50 -0800)
This got caught by gcc on 64bit boxen - IMGSIZE is size_t and that means
range not covered by that of signed 64bit, so we get an unsigned type for
IMGSIZE-*ppos.  On 32bit boxen IMGSIZE-*ppos ends up being loff_t, so the
warning gets silenced.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/usb/misc/idmouse.c

index fd23e92d35280110d10c4dff79fccd4f89ad2308..04f091244e3a250b759ef8d7ad0b37af66e0df97 100644 (file)
@@ -296,7 +296,8 @@ static ssize_t idmouse_read(struct file *file, char __user *buffer, size_t count
                return 0;
        }
 
-       count = min ((loff_t)count, IMGSIZE - (*ppos));
+       if (count > IMGSIZE - *ppos)
+               count = IMGSIZE - *ppos;
 
        if (copy_to_user (buffer, dev->bulk_in_buffer + *ppos, count)) {
                result = -EFAULT;