All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: fix MEDIA_IOC_DEVICE_INFO return code
@ 2012-08-07  9:24 Nicolas THERY
  0 siblings, 0 replies; only message in thread
From: Nicolas THERY @ 2012-08-07  9:24 UTC (permalink / raw)
  To: linux-media@vger.kernel.org

The MEDIA_IOC_DEVICE_INFO ioctl was returning a positive value rather
than a negative error code when failing to copy output parameter to
user-space.

Tested by compilation only.

Signed-off-by: Nicolas Thery <nicolas.thery@st.com>
---
 drivers/media/media-device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 6f9eb94..d01fcb7 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -59,7 +59,9 @@ static int media_device_get_info(struct media_device *dev,
 	info.hw_revision = dev->hw_revision;
 	info.driver_version = dev->driver_version;
 
-	return copy_to_user(__info, &info, sizeof(*__info));
+	if (copy_to_user(__info, &info, sizeof(*__info)))
+		return -EFAULT;
+	return 0;
 }
 
 static struct media_entity *find_entity(struct media_device *mdev, u32 id)
-- 
1.7.11.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-07  9:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-07  9:24 [PATCH] media: fix MEDIA_IOC_DEVICE_INFO return code Nicolas THERY

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.