diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-24 14:15:20 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-05-27 15:39:30 -0400 |
commit | 17e3dade62d6e95131ceba1535eb8d2e84b2e040 (patch) | |
tree | 40aaca0b0f3a0187888255e6eda22295efb266d6 | |
parent | 012c6741c6aa916e276a0dd2f1c0020041540206 (diff) | |
download | linux-stable-17e3dade62d6e95131ceba1535eb8d2e84b2e040.tar.gz linux-stable-17e3dade62d6e95131ceba1535eb8d2e84b2e040.tar.bz2 linux-stable-17e3dade62d6e95131ceba1535eb8d2e84b2e040.zip |
switch compat_drm_getunique() to drm_ioctl_kernel()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/gpu/drm/drm_internal.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_ioc32.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_ioctl.c | 2 |
3 files changed, 10 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index 011205c4c1f4..7299ba01bd99 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -144,3 +144,4 @@ static inline int drm_debugfs_crtc_crc_add(struct drm_crtc *crtc) } #endif drm_ioctl_t drm_version; +drm_ioctl_t drm_getunique; diff --git a/drivers/gpu/drm/drm_ioc32.c b/drivers/gpu/drm/drm_ioc32.c index db1db77f23da..e07ade98c29b 100644 --- a/drivers/gpu/drm/drm_ioc32.c +++ b/drivers/gpu/drm/drm_ioc32.c @@ -125,26 +125,21 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd, unsigned long arg) { drm_unique32_t uq32; - struct drm_unique __user *u; + struct drm_unique uq; int err; if (copy_from_user(&uq32, (void __user *)arg, sizeof(uq32))) return -EFAULT; + uq = (struct drm_unique){ + .unique_len = uq32.unique_len, + .unique = compat_ptr(uq32.unique), + }; - u = compat_alloc_user_space(sizeof(*u)); - if (!u) - return -EFAULT; - if (__put_user(uq32.unique_len, &u->unique_len) - || __put_user((void __user *)(unsigned long)uq32.unique, - &u->unique)) - return -EFAULT; - - err = drm_ioctl(file, DRM_IOCTL_GET_UNIQUE, (unsigned long)u); + err = drm_ioctl_kernel(file, drm_getunique, &uq, DRM_UNLOCKED); if (err) return err; - if (__get_user(uq32.unique_len, &u->unique_len)) - return -EFAULT; + uq32.unique_len = uq.unique_len; if (copy_to_user((void __user *)arg, &uq32, sizeof(uq32))) return -EFAULT; return 0; @@ -1072,7 +1067,7 @@ static struct { } drm_compat_ioctls[] = { #define DRM_IOCTL32_DEF(n, f) [DRM_IOCTL_NR(n##32)] = {.fn = f, .name = #n} DRM_IOCTL32_DEF(DRM_IOCTL_VERSION, compat_drm_version), - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE32)].fn = compat_drm_getunique, + DRM_IOCTL32_DEF(DRM_IOCTL_GET_UNIQUE, compat_drm_getunique), [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP32)].fn = compat_drm_getmap, [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT32)].fn = compat_drm_getclient, [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS32)].fn = compat_drm_getstats, diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index c6cba981ecd0..a7d4d6253096 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -107,7 +107,7 @@ * * Copies the bus id from drm_device::unique into user space. */ -static int drm_getunique(struct drm_device *dev, void *data, +int drm_getunique(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_unique *u = data; |