Skip to content

Commit e552f08

Browse files
bjdooks-ctatseanpaul
authored andcommitted
drm: add __user attribute to ptr_to_compat()
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 Cc: stable@vger.kernel.org Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Sean Paul <seanpaul@chromium.org> Link: https://patchwork.freedesktop.org/patch/msgid/20190301120046.26961-1-ben.dooks@codethink.co.uk
1 parent 37406a6 commit e552f08

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/gpu/drm/drm_ioc32.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
185185
m32.size = map.size;
186186
m32.type = map.type;
187187
m32.flags = map.flags;
188-
m32.handle = ptr_to_compat(map.handle);
188+
m32.handle = ptr_to_compat((void __user *)map.handle);
189189
m32.mtrr = map.mtrr;
190190
if (copy_to_user(argp, &m32, sizeof(m32)))
191191
return -EFAULT;
@@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
216216

217217
m32.offset = map.offset;
218218
m32.mtrr = map.mtrr;
219-
m32.handle = ptr_to_compat(map.handle);
219+
m32.handle = ptr_to_compat((void __user *)map.handle);
220220
if (map.handle != compat_ptr(m32.handle))
221221
pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
222222
map.handle, m32.type, m32.offset);
@@ -526,7 +526,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
526526
if (err)
527527
return err;
528528

529-
req32.handle = ptr_to_compat(req.handle);
529+
req32.handle = ptr_to_compat((void __user *)req.handle);
530530
if (copy_to_user(argp, &req32, sizeof(req32)))
531531
return -EFAULT;
532532

0 commit comments

Comments
 (0)