Skip to content

Commit aef80e2

Browse files
andy-shevwsakernel
authored andcommitted
i2c: dev: Force case user pointers in compat_i2cdev_ioctl()
Sparse has warned us about wrong address space for user pointers: i2c-dev.c:561:50: warning: incorrect type in initializer (different address spaces) i2c-dev.c:561:50: expected unsigned char [usertype] *buf i2c-dev.c:561:50: got void [noderef] __user * Force cast the pointer to (__u8 *) that is used by I²C core code. Note, this is an additional fix to the previously addressed similar issue in the I2C_RDWR case in the same function. Fixes: 3265a7e ("i2c: dev: Add __user annotation") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent 993eb48 commit aef80e2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/i2c/i2c-dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
557557
.addr = umsg.addr,
558558
.flags = umsg.flags,
559559
.len = umsg.len,
560-
.buf = compat_ptr(umsg.buf)
560+
.buf = (__force __u8 *)compat_ptr(umsg.buf),
561561
};
562562
}
563563

0 commit comments

Comments
 (0)