Commit 4b013bb2 authored by Gurchetan Singh's avatar Gurchetan Singh Committed by Gerd Hoffmann

drm/virtio: use u64_to_user_ptr macro

Other DRM drivers use it too.
Signed-off-by: default avatarGurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190604234428.23252-1-gurchetansingh@chromium.orgSigned-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent a5b86878
...@@ -168,7 +168,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, ...@@ -168,7 +168,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
goto out_unused_fd; goto out_unused_fd;
} }
user_bo_handles = (void __user *)(uintptr_t)exbuf->bo_handles; user_bo_handles = u64_to_user_ptr(exbuf->bo_handles);
if (copy_from_user(bo_handles, user_bo_handles, if (copy_from_user(bo_handles, user_bo_handles,
exbuf->num_bo_handles * sizeof(uint32_t))) { exbuf->num_bo_handles * sizeof(uint32_t))) {
ret = -EFAULT; ret = -EFAULT;
...@@ -195,8 +195,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data, ...@@ -195,8 +195,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
if (ret) if (ret)
goto out_free; goto out_free;
buf = memdup_user((void __user *)(uintptr_t)exbuf->command, buf = memdup_user(u64_to_user_ptr(exbuf->command), exbuf->size);
exbuf->size);
if (IS_ERR(buf)) { if (IS_ERR(buf)) {
ret = PTR_ERR(buf); ret = PTR_ERR(buf);
goto out_unresv; goto out_unresv;
...@@ -263,10 +262,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data, ...@@ -263,10 +262,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
default: default:
return -EINVAL; return -EINVAL;
} }
if (copy_to_user((void __user *)(unsigned long)param->value, if (copy_to_user(u64_to_user_ptr(param->value), &value, sizeof(int)))
&value, sizeof(int))) {
return -EFAULT; return -EFAULT;
}
return 0; return 0;
} }
...@@ -545,7 +543,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ...@@ -545,7 +543,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
ptr = cache_ent->caps_cache; ptr = cache_ent->caps_cache;
copy_exit: copy_exit:
if (copy_to_user((void __user *)(unsigned long)args->addr, ptr, size)) if (copy_to_user(u64_to_user_ptr(args->addr), ptr, size))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment