public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] vmwgfx: return an -EFAULT if copy_to_user() fails
@ 2012-11-12 11:07 Dan Carpenter
  2012-11-13 20:57 ` Thomas Hellstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-11-12 11:07 UTC (permalink / raw)
  To: David Airlie
  Cc: kernel-janitors, Thomas Hellstrom, dri-devel, Dave Airlie,
	Thomas Meyer

copy_to_user() returns the number of bytes remaining to be copied, but
we want to return a negative error code here.  I fixed a couple of these
last year, but I missed this one.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I think there were only three copy_to/from_user() functions in this
file and they're all fixed now.

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index b07ca2e..7290811 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,
 	memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
 
 	ret = copy_to_user(buffer, bounce, size);
+	if (ret)
+		ret = -EFAULT;
 	vfree(bounce);
 
 	if (unlikely(ret != 0))

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-11-13 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 11:07 [patch] vmwgfx: return an -EFAULT if copy_to_user() fails Dan Carpenter
2012-11-13 20:57 ` Thomas Hellstrom

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox