fs/compat_ioctl.c: fix an underflow issue (harmless)
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 21 Jan 2014 23:48:43 +0000 (15:48 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 22 Jan 2014 00:19:42 +0000 (16:19 -0800)
We cap "nmsgs" at I2C_RDRW_IOCTL_MAX_MSGS (42) but the current code
allows negative values.  It's harmless but it makes my static checker
upset so I've made nsmgs unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/compat_ioctl.c

index dc52e13d58e021ac5cf7951d44c66c8e8d9a4993..3881610b64384cee634367c3c35d237a4fa2f2aa 100644 (file)
@@ -680,7 +680,8 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
        struct i2c_msg                  __user *tmsgs;
        struct i2c_msg32                __user *umsgs;
        compat_caddr_t                  datap;
-       int                             nmsgs, i;
+       u32                             nmsgs;
+       int                             i;
 
        if (get_user(nmsgs, &udata->nmsgs))
                return -EFAULT;