diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-11-27 12:09:08 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-11-28 02:12:18 -0500 |
commit | 75df62478c84e101e0c4141e4e6c3ed10163de1f (patch) | |
tree | 3bd3b4ec01dd65ad77446d2bd4e0a6581264e98a | |
parent | 8b2fb7b6518d143b382c3490d4a90f8676259ef9 (diff) |
drm: Use u64_to_user_ptr() helper for blob ioctls
Remove the ugly sparse casts by using the helper u64_to_user_ptr()
instead.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161127170910.29106-1-chris@chris-wilson.co.uk
-rw-r--r-- | drivers/gpu/drm/drm_property.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c index d1e50ac6f72b..24be69d29964 100644 --- a/drivers/gpu/drm/drm_property.c +++ b/drivers/gpu/drm/drm_property.c | |||
@@ -729,7 +729,6 @@ int drm_mode_getblob_ioctl(struct drm_device *dev, | |||
729 | struct drm_mode_get_blob *out_resp = data; | 729 | struct drm_mode_get_blob *out_resp = data; |
730 | struct drm_property_blob *blob; | 730 | struct drm_property_blob *blob; |
731 | int ret = 0; | 731 | int ret = 0; |
732 | void __user *blob_ptr; | ||
733 | 732 | ||
734 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 733 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
735 | return -EINVAL; | 734 | return -EINVAL; |
@@ -739,8 +738,9 @@ int drm_mode_getblob_ioctl(struct drm_device *dev, | |||
739 | return -ENOENT; | 738 | return -ENOENT; |
740 | 739 | ||
741 | if (out_resp->length == blob->length) { | 740 | if (out_resp->length == blob->length) { |
742 | blob_ptr = (void __user *)(unsigned long)out_resp->data; | 741 | if (copy_to_user(u64_to_user_ptr(out_resp->data), |
743 | if (copy_to_user(blob_ptr, blob->data, blob->length)) { | 742 | blob->data, |
743 | blob->length)) { | ||
744 | ret = -EFAULT; | 744 | ret = -EFAULT; |
745 | goto unref; | 745 | goto unref; |
746 | } | 746 | } |
@@ -757,7 +757,6 @@ int drm_mode_createblob_ioctl(struct drm_device *dev, | |||
757 | { | 757 | { |
758 | struct drm_mode_create_blob *out_resp = data; | 758 | struct drm_mode_create_blob *out_resp = data; |
759 | struct drm_property_blob *blob; | 759 | struct drm_property_blob *blob; |
760 | void __user *blob_ptr; | ||
761 | int ret = 0; | 760 | int ret = 0; |
762 | 761 | ||
763 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) | 762 | if (!drm_core_check_feature(dev, DRIVER_MODESET)) |
@@ -767,8 +766,9 @@ int drm_mode_createblob_ioctl(struct drm_device *dev, | |||
767 | if (IS_ERR(blob)) | 766 | if (IS_ERR(blob)) |
768 | return PTR_ERR(blob); | 767 | return PTR_ERR(blob); |
769 | 768 | ||
770 | blob_ptr = (void __user *)(unsigned long)out_resp->data; | 769 | if (copy_from_user(blob->data, |
771 | if (copy_from_user(blob->data, blob_ptr, out_resp->length)) { | 770 | u64_to_user_ptr(out_resp->data), |
771 | out_resp->length)) { | ||
772 | ret = -EFAULT; | 772 | ret = -EFAULT; |
773 | goto out_blob; | 773 | goto out_blob; |
774 | } | 774 | } |