aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat_ioctl.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2014-01-21 18:48:43 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:42 -0500
commit38316c8ab7f17bc1be8f2898278d5f5131e18bf2 (patch)
treeb712b7206791c79a5a3c8660b16b0934f90d5949 /fs/compat_ioctl.c
parent0afaa12047a45ebe651f29a3b4818e523f862c28 (diff)
fs/compat_ioctl.c: fix an underflow issue (harmless)
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>
Diffstat (limited to 'fs/compat_ioctl.c')
-rw-r--r--fs/compat_ioctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index dc52e13d58e0..3881610b6438 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -680,7 +680,8 @@ static int do_i2c_rdwr_ioctl(unsigned int fd, unsigned int cmd,
680 struct i2c_msg __user *tmsgs; 680 struct i2c_msg __user *tmsgs;
681 struct i2c_msg32 __user *umsgs; 681 struct i2c_msg32 __user *umsgs;
682 compat_caddr_t datap; 682 compat_caddr_t datap;
683 int nmsgs, i; 683 u32 nmsgs;
684 int i;
684 685
685 if (get_user(nmsgs, &udata->nmsgs)) 686 if (get_user(nmsgs, &udata->nmsgs))
686 return -EFAULT; 687 return -EFAULT;