Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

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 <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
  • Loading branch information...
commit 38316c8ab7f17bc1be8f2898278d5f5131e18bf2 1 parent 0afaa12
Dan Carpenter authored committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  fs/compat_ioctl.c
3  fs/compat_ioctl.c
@@ -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;

0 comments on commit 38316c8

Please sign in to comment.
Something went wrong with that request. Please try again.