All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Eric Anholt <eric@anholt.net>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/3] drm/vc4: Start using u64_to_user_ptr.
Date: Wed, 26 Jul 2017 13:28:15 +0200	[thread overview]
Message-ID: <20170726112815.dkfit54tqlrlkb7q@phenom.ffwll.local> (raw)
In-Reply-To: <20170725182718.31468-1-eric@anholt.net>

On Tue, Jul 25, 2017 at 11:27:16AM -0700, Eric Anholt wrote:
> 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>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index d5b821ad06af..595f93f57821 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -119,7 +119,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
>  		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,
>  			 state->bo_count * sizeof(*bo_state)))
>  		ret = -EFAULT;
> @@ -678,8 +678,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
>  		goto fail;
>  	}
>  
> -	if (copy_from_user(handles,
> -			   (void __user *)(uintptr_t)args->bo_handles,
> +	if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles),
>  			   exec->bo_count * sizeof(uint32_t))) {
>  		ret = -EFAULT;
>  		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;
>  
>  	if (copy_from_user(bin,
> -			   (void __user *)(uintptr_t)args->bin_cl,
> +			   u64_to_user_ptr(args->bin_cl),
>  			   args->bin_cl_size)) {
>  		ret = -EFAULT;
>  		goto fail;
>  	}
>  
>  	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)) {
>  		ret = -EFAULT;
>  		goto fail;
>  	}
>  
>  	if (copy_from_user(exec->uniforms_u,
> -			   (void __user *)(uintptr_t)args->uniforms,
> +			   u64_to_user_ptr(args->uniforms),
>  			   args->uniforms_size)) {
>  		ret = -EFAULT;
>  		goto fail;
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Eric Anholt <eric@anholt.net>
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 1/3] drm/vc4: Start using u64_to_user_ptr.
Date: Wed, 26 Jul 2017 13:28:15 +0200	[thread overview]
Message-ID: <20170726112815.dkfit54tqlrlkb7q@phenom.ffwll.local> (raw)
In-Reply-To: <20170725182718.31468-1-eric@anholt.net>

On Tue, Jul 25, 2017 at 11:27:16AM -0700, Eric Anholt wrote:
> 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>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index d5b821ad06af..595f93f57821 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -119,7 +119,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data,
>  		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,
>  			 state->bo_count * sizeof(*bo_state)))
>  		ret = -EFAULT;
> @@ -678,8 +678,7 @@ vc4_cl_lookup_bos(struct drm_device *dev,
>  		goto fail;
>  	}
>  
> -	if (copy_from_user(handles,
> -			   (void __user *)(uintptr_t)args->bo_handles,
> +	if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles),
>  			   exec->bo_count * sizeof(uint32_t))) {
>  		ret = -EFAULT;
>  		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;
>  
>  	if (copy_from_user(bin,
> -			   (void __user *)(uintptr_t)args->bin_cl,
> +			   u64_to_user_ptr(args->bin_cl),
>  			   args->bin_cl_size)) {
>  		ret = -EFAULT;
>  		goto fail;
>  	}
>  
>  	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)) {
>  		ret = -EFAULT;
>  		goto fail;
>  	}
>  
>  	if (copy_from_user(exec->uniforms_u,
> -			   (void __user *)(uintptr_t)args->uniforms,
> +			   u64_to_user_ptr(args->uniforms),
>  			   args->uniforms_size)) {
>  		ret = -EFAULT;
>  		goto fail;
> -- 
> 2.11.0
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-07-26 11:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25 18:27 [PATCH v2 1/3] drm/vc4: Start using u64_to_user_ptr Eric Anholt
2017-07-25 18:27 ` Eric Anholt
2017-07-25 18:27 ` [PATCH v2 2/3] drm/vc4: Add an ioctl for labeling GEM BOs for summary stats Eric Anholt
2017-07-25 18:27   ` Eric Anholt
2017-07-25 18:27 ` [PATCH v2 3/3] drm/vc4: Convert more lock requirement comments to lockdep assertions Eric Anholt
2017-07-25 18:27   ` Eric Anholt
2017-07-26 11:37   ` Daniel Vetter
2017-07-26 11:37     ` Daniel Vetter
2017-07-26 11:28 ` Daniel Vetter [this message]
2017-07-26 11:28   ` [PATCH v2 1/3] drm/vc4: Start using u64_to_user_ptr Daniel Vetter
2017-07-29  0:51   ` Eric Anholt
2017-07-29  0:51     ` Eric Anholt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170726112815.dkfit54tqlrlkb7q@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.