* [PATCH] drm: add __user attribute to ptr_to_compat()
@ 2019-03-01 12:00 Ben Dooks
2019-03-04 16:08 ` Sean Paul
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2019-03-01 12:00 UTC (permalink / raw)
To: dri-devel; +Cc: Maxime Ripard, David Airlie, Ben Dooks, Sean Paul
The ptr_to_compat() call takes a "void __user *", so cast
the compat drm calls that use it to avoid the following
warnings from sparse:
drivers/gpu/drm/drm_ioc32.c:188:39: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/drm_ioc32.c:188:39: expected void [noderef] <asn:1>*uptr
drivers/gpu/drm/drm_ioc32.c:188:39: got void *[addressable] [assigned] handle
drivers/gpu/drm/drm_ioc32.c:529:41: warning: incorrect type in argument 1 (different address spaces)
drivers/gpu/drm/drm_ioc32.c:529:41: expected void [noderef] <asn:1>*uptr
drivers/gpu/drm/drm_ioc32.c:529:41: got void *[addressable] [assigned] handle
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/gpu/drm/drm_ioc32.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
index 67b1fca39aa6..0e3043e08c69 100644
--- a/drivers/gpu/drm/drm_ioc32.c
+++ b/drivers/gpu/drm/drm_ioc32.c
@@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
m32.size = map.size;
m32.type = map.type;
m32.flags = map.flags;
- m32.handle = ptr_to_compat(map.handle);
+ m32.handle = ptr_to_compat((void __user *)map.handle);
m32.mtrr = map.mtrr;
if (copy_to_user(argp, &m32, sizeof(m32)))
return -EFAULT;
@@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
m32.offset = map.offset;
m32.mtrr = map.mtrr;
- m32.handle = ptr_to_compat(map.handle);
+ m32.handle = ptr_to_compat((void __user *)map.handle);
if (map.handle != compat_ptr(m32.handle))
pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
map.handle, m32.type, m32.offset);
@@ -526,7 +526,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
if (err)
return err;
- req32.handle = ptr_to_compat(req.handle);
+ req32.handle = ptr_to_compat((void __user *)req.handle);
if (copy_to_user(argp, &req32, sizeof(req32)))
return -EFAULT;
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: add __user attribute to ptr_to_compat()
2019-03-01 12:00 [PATCH] drm: add __user attribute to ptr_to_compat() Ben Dooks
@ 2019-03-04 16:08 ` Sean Paul
0 siblings, 0 replies; 2+ messages in thread
From: Sean Paul @ 2019-03-04 16:08 UTC (permalink / raw)
To: Ben Dooks; +Cc: Maxime Ripard, dri-devel, David Airlie, Sean Paul
On Fri, Mar 01, 2019 at 12:00:46PM +0000, Ben Dooks wrote:
> The ptr_to_compat() call takes a "void __user *", so cast
> the compat drm calls that use it to avoid the following
> warnings from sparse:
>
> drivers/gpu/drm/drm_ioc32.c:188:39: warning: incorrect type in argument 1 (different address spaces)
> drivers/gpu/drm/drm_ioc32.c:188:39: expected void [noderef] <asn:1>*uptr
> drivers/gpu/drm/drm_ioc32.c:188:39: got void *[addressable] [assigned] handle
> drivers/gpu/drm/drm_ioc32.c:529:41: warning: incorrect type in argument 1 (different address spaces)
> drivers/gpu/drm/drm_ioc32.c:529:41: expected void [noderef] <asn:1>*uptr
> drivers/gpu/drm/drm_ioc32.c:529:41: got void *[addressable] [assigned] handle
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Thanks for your patch, I've applied it to drm-misc-next-fixes with cc: stable.
Sean
> ---
> drivers/gpu/drm/drm_ioc32.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c
> index 67b1fca39aa6..0e3043e08c69 100644
> --- a/drivers/gpu/drm/drm_ioc32.c
> +++ b/drivers/gpu/drm/drm_ioc32.c
> @@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
> m32.size = map.size;
> m32.type = map.type;
> m32.flags = map.flags;
> - m32.handle = ptr_to_compat(map.handle);
> + m32.handle = ptr_to_compat((void __user *)map.handle);
> m32.mtrr = map.mtrr;
> if (copy_to_user(argp, &m32, sizeof(m32)))
> return -EFAULT;
> @@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
>
> m32.offset = map.offset;
> m32.mtrr = map.mtrr;
> - m32.handle = ptr_to_compat(map.handle);
> + m32.handle = ptr_to_compat((void __user *)map.handle);
> if (map.handle != compat_ptr(m32.handle))
> pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
> map.handle, m32.type, m32.offset);
> @@ -526,7 +526,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
> if (err)
> return err;
>
> - req32.handle = ptr_to_compat(req.handle);
> + req32.handle = ptr_to_compat((void __user *)req.handle);
> if (copy_to_user(argp, &req32, sizeof(req32)))
> return -EFAULT;
>
> --
> 2.20.1
>
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-04 16:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-01 12:00 [PATCH] drm: add __user attribute to ptr_to_compat() Ben Dooks
2019-03-04 16:08 ` Sean Paul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).