hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/gpu/drm/i915/i915_ioc32.c
....@@ -28,9 +28,10 @@
2828 */
2929 #include <linux/compat.h>
3030
31
-#include <drm/drmP.h>
32
-#include <drm/i915_drm.h>
31
+#include <drm/drm_ioctl.h>
32
+
3333 #include "i915_drv.h"
34
+#include "i915_ioc32.h"
3435
3536 struct drm_i915_getparam32 {
3637 s32 param;
....@@ -46,20 +47,16 @@
4647 unsigned long arg)
4748 {
4849 struct drm_i915_getparam32 req32;
49
- drm_i915_getparam_t __user *request;
50
+ struct drm_i915_getparam req;
5051
5152 if (copy_from_user(&req32, (void __user *)arg, sizeof(req32)))
5253 return -EFAULT;
5354
54
- request = compat_alloc_user_space(sizeof(*request));
55
- if (!access_ok(VERIFY_WRITE, request, sizeof(*request)) ||
56
- __put_user(req32.param, &request->param) ||
57
- __put_user((void __user *)(unsigned long)req32.value,
58
- &request->value))
59
- return -EFAULT;
55
+ req.param = req32.param;
56
+ req.value = compat_ptr(req32.value);
6057
61
- return drm_ioctl(file, DRM_IOCTL_I915_GETPARAM,
62
- (unsigned long)request);
58
+ return drm_ioctl_kernel(file, i915_getparam_ioctl, &req,
59
+ DRM_RENDER_ALLOW);
6360 }
6461
6562 static drm_ioctl_compat_t *i915_compat_ioctls[] = {
....@@ -67,7 +64,7 @@
6764 };
6865
6966 /**
70
- * i915_compat_ioctl - handle the mistakes of the past
67
+ * i915_ioc32_compat_ioctl - handle the mistakes of the past
7168 * @filp: the file pointer
7269 * @cmd: the ioctl command (and encoded flags)
7370 * @arg: the ioctl argument (from userspace)
....@@ -75,7 +72,7 @@
7572 * Called whenever a 32-bit process running under a 64-bit kernel
7673 * performs an ioctl on /dev/dri/card<n>.
7774 */
78
-long i915_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
75
+long i915_ioc32_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
7976 {
8077 unsigned int nr = DRM_IOCTL_NR(cmd);
8178 drm_ioctl_compat_t *fn = NULL;