diff options
author | Dave Airlie <airlied@linux.ie> | 2007-06-10 02:00:27 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2007-06-10 02:00:27 -0400 |
commit | 9b01bd5b284bbf519b726b39f1352023cb5e9e69 (patch) | |
tree | 910e0616eb903aedd051e936d1faa3618ee43f77 /drivers/char/drm | |
parent | dc7a93190c21edbf3ed23e678ad04f852b9cff28 (diff) |
drm: fix radeon setparam on 32/64 bit systems.
The alignment on 64-bit is different for 64-bit values.
Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm')
-rw-r--r-- | drivers/char/drm/radeon_ioc32.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/char/drm/radeon_ioc32.c b/drivers/char/drm/radeon_ioc32.c index 1f1f9cc055a4..04126c2e79ab 100644 --- a/drivers/char/drm/radeon_ioc32.c +++ b/drivers/char/drm/radeon_ioc32.c | |||
@@ -349,6 +349,31 @@ static int compat_radeon_irq_emit(struct file *file, unsigned int cmd, | |||
349 | DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); | 349 | DRM_IOCTL_RADEON_IRQ_EMIT, (unsigned long)request); |
350 | } | 350 | } |
351 | 351 | ||
352 | typedef struct drm_radeon_setparam32 { | ||
353 | int param; | ||
354 | u64 value; | ||
355 | } __attribute__((packed)) drm_radeon_setparam32_t; | ||
356 | |||
357 | static int compat_radeon_cp_setparam(struct file *file, unsigned int cmd, | ||
358 | unsigned long arg) | ||
359 | { | ||
360 | drm_radeon_setparam32_t req32; | ||
361 | drm_radeon_setparam_t __user *request; | ||
362 | |||
363 | if (copy_from_user(&req32, (void __user *) arg, sizeof(req32))) | ||
364 | return -EFAULT; | ||
365 | |||
366 | request = compat_alloc_user_space(sizeof(*request)); | ||
367 | if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) | ||
368 | || __put_user(req32.param, &request->param) | ||
369 | || __put_user((void __user *)(unsigned long)req32.value, | ||
370 | &request->value)) | ||
371 | return -EFAULT; | ||
372 | |||
373 | return drm_ioctl(file->f_dentry->d_inode, file, | ||
374 | DRM_IOCTL_RADEON_SETPARAM, (unsigned long) request); | ||
375 | } | ||
376 | |||
352 | drm_ioctl_compat_t *radeon_compat_ioctls[] = { | 377 | drm_ioctl_compat_t *radeon_compat_ioctls[] = { |
353 | [DRM_RADEON_CP_INIT] = compat_radeon_cp_init, | 378 | [DRM_RADEON_CP_INIT] = compat_radeon_cp_init, |
354 | [DRM_RADEON_CLEAR] = compat_radeon_cp_clear, | 379 | [DRM_RADEON_CLEAR] = compat_radeon_cp_clear, |
@@ -357,6 +382,7 @@ drm_ioctl_compat_t *radeon_compat_ioctls[] = { | |||
357 | [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2, | 382 | [DRM_RADEON_VERTEX2] = compat_radeon_cp_vertex2, |
358 | [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf, | 383 | [DRM_RADEON_CMDBUF] = compat_radeon_cp_cmdbuf, |
359 | [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam, | 384 | [DRM_RADEON_GETPARAM] = compat_radeon_cp_getparam, |
385 | [DRM_RADEON_SETPARAM] = compat_radeon_cp_setparam, | ||
360 | [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc, | 386 | [DRM_RADEON_ALLOC] = compat_radeon_mem_alloc, |
361 | [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit, | 387 | [DRM_RADEON_IRQ_EMIT] = compat_radeon_irq_emit, |
362 | }; | 388 | }; |