* [PATCH] drm/i915: Drop the misleading cast to the wrong user pointer type
@ 2012-09-14 10:46 Chris Wilson
2012-09-14 13:24 ` Jani Nikula
0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2012-09-14 10:46 UTC (permalink / raw)
To: intel-gfx
The exec_list is of type drm_i915_gem_exec_object2 and so casting it to
a drm_i915_gem_relocation_entry is very confusing!
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 4ab0083..8186f63 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1102,8 +1102,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
return -ENOMEM;
}
ret = copy_from_user(exec_list,
- (struct drm_i915_relocation_entry __user *)
- (uintptr_t) args->buffers_ptr,
+ (void __user *)(uintptr_t)args->buffers_ptr,
sizeof(*exec_list) * args->buffer_count);
if (ret != 0) {
DRM_DEBUG("copy %d exec entries failed %d\n",
@@ -1142,8 +1141,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
for (i = 0; i < args->buffer_count; i++)
exec_list[i].offset = exec2_list[i].offset;
/* ... and back out to userspace */
- ret = copy_to_user((struct drm_i915_relocation_entry __user *)
- (uintptr_t) args->buffers_ptr,
+ ret = copy_to_user((void __user *)(uintptr_t)args->buffers_ptr,
exec_list,
sizeof(*exec_list) * args->buffer_count);
if (ret) {
@@ -1197,8 +1195,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
ret = i915_gem_do_execbuffer(dev, data, file, args, exec2_list);
if (!ret) {
/* Copy the new buffer offsets back to the user's exec list. */
- ret = copy_to_user((struct drm_i915_relocation_entry __user *)
- (uintptr_t) args->buffers_ptr,
+ ret = copy_to_user((void __user *)(uintptr_t)args->buffers_ptr,
exec2_list,
sizeof(*exec2_list) * args->buffer_count);
if (ret) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/i915: Drop the misleading cast to the wrong user pointer type
2012-09-14 10:46 [PATCH] drm/i915: Drop the misleading cast to the wrong user pointer type Chris Wilson
@ 2012-09-14 13:24 ` Jani Nikula
2012-09-14 16:31 ` Daniel Vetter
0 siblings, 1 reply; 3+ messages in thread
From: Jani Nikula @ 2012-09-14 13:24 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
On Fri, 14 Sep 2012, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> The exec_list is of type drm_i915_gem_exec_object2 and so casting it to
> a drm_i915_gem_relocation_entry is very confusing!
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem_execbuffer.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> index 4ab0083..8186f63 100644
> --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
> @@ -1102,8 +1102,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
> return -ENOMEM;
> }
> ret = copy_from_user(exec_list,
> - (struct drm_i915_relocation_entry __user *)
> - (uintptr_t) args->buffers_ptr,
> + (void __user *)(uintptr_t)args->buffers_ptr,
> sizeof(*exec_list) * args->buffer_count);
> if (ret != 0) {
> DRM_DEBUG("copy %d exec entries failed %d\n",
> @@ -1142,8 +1141,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
> for (i = 0; i < args->buffer_count; i++)
> exec_list[i].offset = exec2_list[i].offset;
> /* ... and back out to userspace */
> - ret = copy_to_user((struct drm_i915_relocation_entry __user *)
> - (uintptr_t) args->buffers_ptr,
> + ret = copy_to_user((void __user *)(uintptr_t)args->buffers_ptr,
> exec_list,
> sizeof(*exec_list) * args->buffer_count);
> if (ret) {
> @@ -1197,8 +1195,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
> ret = i915_gem_do_execbuffer(dev, data, file, args, exec2_list);
> if (!ret) {
> /* Copy the new buffer offsets back to the user's exec list. */
> - ret = copy_to_user((struct drm_i915_relocation_entry __user *)
> - (uintptr_t) args->buffers_ptr,
> + ret = copy_to_user((void __user *)(uintptr_t)args->buffers_ptr,
> exec2_list,
> sizeof(*exec2_list) * args->buffer_count);
> if (ret) {
> --
> 1.7.10.4
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drm/i915: Drop the misleading cast to the wrong user pointer type
2012-09-14 13:24 ` Jani Nikula
@ 2012-09-14 16:31 ` Daniel Vetter
0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2012-09-14 16:31 UTC (permalink / raw)
To: Jani Nikula; +Cc: intel-gfx
On Fri, Sep 14, 2012 at 04:24:46PM +0300, Jani Nikula wrote:
> On Fri, 14 Sep 2012, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > The exec_list is of type drm_i915_gem_exec_object2 and so casting it to
> > a drm_i915_gem_relocation_entry is very confusing!
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Queued for -next, thanks for the patch.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-14 16:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-14 10:46 [PATCH] drm/i915: Drop the misleading cast to the wrong user pointer type Chris Wilson
2012-09-14 13:24 ` Jani Nikula
2012-09-14 16:31 ` Daniel Vetter
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.