Skip to contentSkip to conversation

drm/i915: Fix a bogus cast in execbuffer2

PATCH In review [email protected] 2 participants 2 messages Feb 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Fix a bogus cast in execbuffer2

From: Ville Syrjälä <[email protected]>

The pointer passed to copy_from_user() was cast to the wrong type. This doesn't cause any issues, but it confuses the reader. Just cast to void * like we do for the other execbuffer kernel<->user copies.

---
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_gem_execbuffer.c +1 -2
index 2f2daeb..9efe04f 100644
@@ -1190,8 +1190,7 @@ i915_gem_execbuffer2(struct drm_device *dev, void *data,
 		return -ENOMEM;
 	}
 	ret = copy_from_user(exec2_list,
-			     (struct drm_i915_relocation_entry __user *)
-			     (uintptr_t) args->buffers_ptr,
+			     (void __user *)(uintptr_t)args->buffers_ptr,
 			     sizeof(*exec2_list) * args->buffer_count);
 	if (ret != 0) {
 		DRM_DEBUG("copy %d exec entries failed %d\n",
Signature · 6 lines
1.7.12.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 5 lines · On Fri, Feb 22, 2013 at 03:42:22PM +0200, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

The pointer passed to copy_from_user() was cast to the wrong type. This doesn't cause any issues, but it confuses the reader. Just cast to void * like we do for the other execbuffer kernel<->user copies.

static inline void __user *to_user_ptr(u64 address)

  {
	return (void __user *)(uintptr_t)address;

}

That should tidy up this repeated idiom.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre