mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 06:12:08 +00:00
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>
This commit is contained in:
parent
0afaa12047
commit
38316c8ab7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user