Skip to contentSkip to conversation

vmwgfx: return -EFAULT instead of number of bytes remaining

PATCH In review Dan Carpenter 2 participants 2 messages Oct 18, 2011

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vmwgfx: return -EFAULT instead of number of bytes remaining

The intent here was to return an error code, but instead the code returns the number of bytes remaining (that weren't copied).

drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +2 -0
index 97f23ab..3f63435 100644
@@ -150,6 +150,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
 	ret = copy_from_user(clips, clips_ptr, num_clips * sizeof(*clips));
 	if (ret) {
 		DRM_ERROR("Failed to copy clip rects from userspace.\n");
+		ret = -EFAULT;
 		goto out_no_copy;
 	}
 
@@ -241,6 +242,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
 	ret = copy_from_user(clips, clips_ptr, num_clips * sizeof(*clips));
 	if (ret) {
 		DRM_ERROR("Failed to copy clip rects from userspace.\n");
+		ret = -EFAULT;
 		goto out_no_copy;
 	}
 
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The intent here was to return an error code, but instead the code returns the number of bytes remaining (that weren't copied).

Quoted 21 lines
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +2 -0
index 97f23ab..3f63435 100644
@@ -150,6 +150,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
  	ret = copy_from_user(clips, clips_ptr, num_clips * sizeof(*clips));
  	if (ret) {
  		DRM_ERROR("Failed to copy clip rects from userspace.\n");
+		ret = -EFAULT;
  		goto out_no_copy;
  	}
 
@@ -241,6 +242,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
  	ret = copy_from_user(clips, clips_ptr, num_clips * sizeof(*clips));
  	if (ret) {
  		DRM_ERROR("Failed to copy clip rects from userspace.\n");
+		ret = -EFAULT;
  		goto out_no_copy;
  	}