Commit c6f08966 authored by Al Viro's avatar Al Viro

switch compat_drm_dma() to drm_ioctl_kernel()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9e075680
...@@ -584,38 +584,26 @@ static int compat_drm_dma(struct file *file, unsigned int cmd, ...@@ -584,38 +584,26 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
{ {
drm_dma32_t d32; drm_dma32_t d32;
drm_dma32_t __user *argp = (void __user *)arg; drm_dma32_t __user *argp = (void __user *)arg;
struct drm_dma __user *d; struct drm_dma d;
int err; int err;
if (copy_from_user(&d32, argp, sizeof(d32))) if (copy_from_user(&d32, argp, sizeof(d32)))
return -EFAULT; return -EFAULT;
d = compat_alloc_user_space(sizeof(*d)); d.context = d32.context;
if (!d) d.send_count = d32.send_count;
return -EFAULT; d.send_indices = compat_ptr(d32.send_indices);
d.send_sizes = compat_ptr(d32.send_sizes);
if (__put_user(d32.context, &d->context) d.flags = d32.flags;
|| __put_user(d32.send_count, &d->send_count) d.request_count = d32.request_count;
|| __put_user((int __user *)(unsigned long)d32.send_indices, d.request_indices = compat_ptr(d32.request_indices);
&d->send_indices) d.request_sizes = compat_ptr(d32.request_sizes);
|| __put_user((int __user *)(unsigned long)d32.send_sizes, err = drm_ioctl_kernel(file, drm_legacy_dma_ioctl, &d, DRM_AUTH);
&d->send_sizes)
|| __put_user(d32.flags, &d->flags)
|| __put_user(d32.request_count, &d->request_count)
|| __put_user((int __user *)(unsigned long)d32.request_indices,
&d->request_indices)
|| __put_user((int __user *)(unsigned long)d32.request_sizes,
&d->request_sizes))
return -EFAULT;
err = drm_ioctl(file, DRM_IOCTL_DMA, (unsigned long)d);
if (err) if (err)
return err; return err;
if (__get_user(d32.request_size, &d->request_size) if (put_user(d.request_size, &argp->request_size)
|| __get_user(d32.granted_count, &d->granted_count) || put_user(d.granted_count, &argp->granted_count))
|| __put_user(d32.request_size, &argp->request_size)
|| __put_user(d32.granted_count, &argp->granted_count))
return -EFAULT; return -EFAULT;
return 0; return 0;
...@@ -996,7 +984,7 @@ static struct { ...@@ -996,7 +984,7 @@ static struct {
DRM_IOCTL32_DEF(DRM_IOCTL_SET_SAREA_CTX, compat_drm_setsareactx), DRM_IOCTL32_DEF(DRM_IOCTL_SET_SAREA_CTX, compat_drm_setsareactx),
DRM_IOCTL32_DEF(DRM_IOCTL_GET_SAREA_CTX, compat_drm_getsareactx), DRM_IOCTL32_DEF(DRM_IOCTL_GET_SAREA_CTX, compat_drm_getsareactx),
DRM_IOCTL32_DEF(DRM_IOCTL_RES_CTX, compat_drm_resctx), DRM_IOCTL32_DEF(DRM_IOCTL_RES_CTX, compat_drm_resctx),
[DRM_IOCTL_NR(DRM_IOCTL_DMA32)].fn = compat_drm_dma, DRM_IOCTL32_DEF(DRM_IOCTL_DMA, compat_drm_dma),
#if IS_ENABLED(CONFIG_AGP) #if IS_ENABLED(CONFIG_AGP)
[DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE32)].fn = compat_drm_agp_enable, [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE32)].fn = compat_drm_agp_enable,
[DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO32)].fn = compat_drm_agp_info, [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO32)].fn = compat_drm_agp_info,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment