drm/vc4: Start using u64_to_user_ptr.
Chris Wilson pointed out this little cleanup in a review of new code, so let's fix up the code I was copying from. Signed-off-by: Eric Anholt <eric@anholt.net> Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-1-eric@anholt.net Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
@ -119,7 +119,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
|
|||||||
bo_state[i].size = vc4_bo->base.base.size;
|
bo_state[i].size = vc4_bo->base.base.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_to_user((void __user *)(uintptr_t)get_state->bo,
|
if (copy_to_user(u64_to_user_ptr(get_state->bo),
|
||||||
bo_state,
|
bo_state,
|
||||||
state->bo_count * sizeof(*bo_state)))
|
state->bo_count * sizeof(*bo_state)))
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
@ -678,8 +678,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_from_user(handles,
|
if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles),
|
||||||
(void __user *)(uintptr_t)args->bo_handles,
|
|
||||||
exec->bo_count * sizeof(uint32_t))) {
|
exec->bo_count * sizeof(uint32_t))) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
DRM_ERROR("Failed to copy in GEM handles\n");
|
DRM_ERROR("Failed to copy in GEM handles\n");
|
||||||
@ -755,21 +754,21 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec)
|
|||||||
exec->shader_state_size = args->shader_rec_count;
|
exec->shader_state_size = args->shader_rec_count;
|
||||||
|
|
||||||
if (copy_from_user(bin,
|
if (copy_from_user(bin,
|
||||||
(void __user *)(uintptr_t)args->bin_cl,
|
u64_to_user_ptr(args->bin_cl),
|
||||||
args->bin_cl_size)) {
|
args->bin_cl_size)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_from_user(exec->shader_rec_u,
|
if (copy_from_user(exec->shader_rec_u,
|
||||||
(void __user *)(uintptr_t)args->shader_rec,
|
u64_to_user_ptr(args->shader_rec),
|
||||||
args->shader_rec_size)) {
|
args->shader_rec_size)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copy_from_user(exec->uniforms_u,
|
if (copy_from_user(exec->uniforms_u,
|
||||||
(void __user *)(uintptr_t)args->uniforms,
|
u64_to_user_ptr(args->uniforms),
|
||||||
args->uniforms_size)) {
|
args->uniforms_size)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto fail;
|
goto fail;
|
||||||
|
Reference in New Issue
Block a user