aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_ioctl.c')
-rw-r--r--drivers/char/drm/drm_ioctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/char/drm/drm_ioctl.c b/drivers/char/drm/drm_ioctl.c
index 555f323b8a32..31dfe83141ea 100644
--- a/drivers/char/drm/drm_ioctl.c
+++ b/drivers/char/drm/drm_ioctl.c
@@ -331,21 +331,23 @@ int drm_setversion(DRM_IOCTL_ARGS)
331 int if_version; 331 int if_version;
332 drm_set_version_t __user *argp = (void __user *)data; 332 drm_set_version_t __user *argp = (void __user *)data;
333 333
334 DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv)); 334 if (copy_from_user(&sv, argp, sizeof(sv)))
335 return -EFAULT;
335 336
336 retv.drm_di_major = DRM_IF_MAJOR; 337 retv.drm_di_major = DRM_IF_MAJOR;
337 retv.drm_di_minor = DRM_IF_MINOR; 338 retv.drm_di_minor = DRM_IF_MINOR;
338 retv.drm_dd_major = dev->driver->major; 339 retv.drm_dd_major = dev->driver->major;
339 retv.drm_dd_minor = dev->driver->minor; 340 retv.drm_dd_minor = dev->driver->minor;
340 341
341 DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv)); 342 if (copy_to_user(argp, &retv, sizeof(sv)))
343 return -EFAULT;
342 344
343 if (sv.drm_di_major != -1) { 345 if (sv.drm_di_major != -1) {
344 if (sv.drm_di_major != DRM_IF_MAJOR || 346 if (sv.drm_di_major != DRM_IF_MAJOR ||
345 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR) 347 sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
346 return EINVAL; 348 return EINVAL;
347 if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor); 349 if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
348 dev->if_version = DRM_MAX(if_version, dev->if_version); 350 dev->if_version = max(if_version, dev->if_version);
349 if (sv.drm_di_minor >= 1) { 351 if (sv.drm_di_minor >= 1) {
350 /* 352 /*
351 * Version 1.1 includes tying of DRM to specific device 353 * Version 1.1 includes tying of DRM to specific device