]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] media: fix MEDIA_IOC_DEVICE_INFO return code
authorNicolas THERY <nicolas.thery@st.com>
Tue, 7 Aug 2012 08:24:59 +0000 (05:24 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 12 Aug 2012 10:57:57 +0000 (07:57 -0300)
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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/media-device.c

index 6f9eb94e85b387f78f144fd74c244e0e0859237a..d01fcb7e87c2558e1b2c48c504d7dda0efada8df 100644 (file)
@@ -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)