Skip to contentSkip to conversation

media: fix MEDIA_IOC_DEVICE_INFO return code

PATCH New Nicolas THERY 1 participant 1 message Aug 7, 2012 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: fix MEDIA_IOC_DEVICE_INFO return code

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.

---
 drivers/media/media-device.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/media-device.c +3 -1
index 6f9eb94..d01fcb7 100644
@@ -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)
Signature · 1 line
1.7.11.3