diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-25 01:18:06 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-27 21:39:33 +0200 |
commit | 8547ee9d448be87858f59e3590fc54fc2574cd05 (patch) | |
tree | 22d2bb0c780f303d70d4a5f5e71612276324beb4 /drivers/gpu/drm/drm_ioc32.c | |
parent | switch compat_drm_getclient() to drm_ioctl_kernel() (diff) | |
download | linux-8547ee9d448be87858f59e3590fc54fc2574cd05.tar.xz linux-8547ee9d448be87858f59e3590fc54fc2574cd05.zip |
switch compat_drm_getstats() to drm_ioctl_kernel()
The reason we call drm_ioctl_kernel() at all is that we want error
handling; conversions would be pointless there - user buffer is
simply zeroed.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/gpu/drm/drm_ioc32.c')
-rw-r--r-- | drivers/gpu/drm/drm_ioc32.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index 7f36cbe066da..d7c14274c8b2 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c @@ -298,28 +298,14 @@ typedef struct drm_stats32 { static int compat_drm_getstats(struct file *file, unsigned int cmd, unsigned long arg) { - drm_stats32_t s32; drm_stats32_t __user *argp = (void __user *)arg; - struct drm_stats __user *stats; - int i, err; - - memset(&s32, 0, sizeof(drm_stats32_t)); - stats = compat_alloc_user_space(sizeof(*stats)); - if (!stats) - return -EFAULT; + int err; - err = drm_ioctl(file, DRM_IOCTL_GET_STATS, (unsigned long)stats); + err = drm_ioctl_kernel(file, drm_noop, NULL, DRM_UNLOCKED); if (err) return err; - if (__get_user(s32.count, &stats->count)) - return -EFAULT; - for (i = 0; i < 15; ++i) - if (__get_user(s32.data[i].value, &stats->data[i].value) - || __get_user(s32.data[i].type, &stats->data[i].type)) - return -EFAULT; - - if (copy_to_user(argp, &s32, sizeof(s32))) + if (clear_user(argp, sizeof(drm_stats32_t))) return -EFAULT; return 0; } @@ -1033,7 +1019,7 @@ static struct { DRM_IOCTL32_DEF(DRM_IOCTL_GET_UNIQUE, compat_drm_getunique), DRM_IOCTL32_DEF(DRM_IOCTL_GET_MAP, compat_drm_getmap), DRM_IOCTL32_DEF(DRM_IOCTL_GET_CLIENT, compat_drm_getclient), - [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS32)].fn = compat_drm_getstats, + DRM_IOCTL32_DEF(DRM_IOCTL_GET_STATS, compat_drm_getstats), DRM_IOCTL32_DEF(DRM_IOCTL_SET_UNIQUE, compat_drm_setunique), [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP32)].fn = compat_drm_addmap, DRM_IOCTL32_DEF(DRM_IOCTL_ADD_BUFS, compat_drm_addbufs), |