Skip to content

Commit

Permalink
fs/compat_ioctl.c: fix an underflow issue (harmless)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Dan Carpenter authored and torvalds committed Jan 22, 2014
1 parent 0afaa12 commit 38316c8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/compat_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 38316c8

Please sign in to comment.