* [PATCH] i2c: i2c-dev: Add __user annotation
@ 2021-06-24 15:25 Andreas Hecht
2021-06-24 19:48 ` Wolfram Sang
0 siblings, 1 reply; 2+ messages in thread
From: Andreas Hecht @ 2021-06-24 15:25 UTC (permalink / raw)
To: wsa; +Cc: linux-i2c, linux-kernel, Andreas Hecht
Fix Sparse warnings:
drivers/i2c/i2c-dev.c:546:19: warning: incorrect type in assignment (different address spaces)
drivers/i2c/i2c-dev.c:549:53: warning: incorrect type in argument 2 (different address spaces)
compat_ptr() returns a pointer tagged __user which gets assigned to a
pointer missing the __user annotation. The same pointer is passed to
copy_from_user() as an argument where it is expected to have the __user
annotation. Fix both by adding the __user annotation to the pointer.
Signed-off-by: Andreas Hecht <andreas.e.hecht@gmail.com>
---
drivers/i2c/i2c-dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 6ef38a8ee95c..cb64fe649390 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -526,7 +526,7 @@ static long compat_i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned lo
return put_user(funcs, (compat_ulong_t __user *)arg);
case I2C_RDWR: {
struct i2c_rdwr_ioctl_data32 rdwr_arg;
- struct i2c_msg32 *p;
+ struct i2c_msg32 __user *p;
struct i2c_msg *rdwr_pa;
int i;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] i2c: i2c-dev: Add __user annotation
2021-06-24 15:25 [PATCH] i2c: i2c-dev: Add __user annotation Andreas Hecht
@ 2021-06-24 19:48 ` Wolfram Sang
0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2021-06-24 19:48 UTC (permalink / raw)
To: Andreas Hecht; +Cc: linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 693 bytes --]
On Thu, Jun 24, 2021 at 05:25:35PM +0200, Andreas Hecht wrote:
> Fix Sparse warnings:
> drivers/i2c/i2c-dev.c:546:19: warning: incorrect type in assignment (different address spaces)
> drivers/i2c/i2c-dev.c:549:53: warning: incorrect type in argument 2 (different address spaces)
>
> compat_ptr() returns a pointer tagged __user which gets assigned to a
> pointer missing the __user annotation. The same pointer is passed to
> copy_from_user() as an argument where it is expected to have the __user
> annotation. Fix both by adding the __user annotation to the pointer.
>
> Signed-off-by: Andreas Hecht <andreas.e.hecht@gmail.com>
Nice catch. Applied to for-current, thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-06-24 19:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 15:25 [PATCH] i2c: i2c-dev: Add __user annotation Andreas Hecht
2021-06-24 19:48 ` Wolfram Sang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.