[PATCH] drivers/media/video/v4l2-compat-ioctl32.c: Check the return value of copy_to_user

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fix the following warning:
drivers/media/video/v4l2-compat-ioctl32.c: In function âget_microcode32â:
drivers/media/video/v4l2-compat-ioctl32.c:209: warning: ignoring return value of âcopy_to_userâ, declared with attribute warn_unused_result

Signed-off-by: Thiago Farina <tfransosi@xxxxxxxxx>
---
 drivers/media/video/v4l2-compat-ioctl32.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c
index e30e8df..55825ec 100644
--- a/drivers/media/video/v4l2-compat-ioctl32.c
+++ b/drivers/media/video/v4l2-compat-ioctl32.c
@@ -206,7 +206,9 @@ static struct video_code __user *get_microcode32(struct video_code32 *kp)
 	 * user address is invalid, the native ioctl will do
 	 * the error handling for us
 	 */
-	(void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat));
+	if (copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)))
+		return NULL;
+
 	(void) put_user(kp->datasize, &up->datasize);
 	(void) put_user(compat_ptr(kp->data), &up->data);
 	return up;
-- 
1.7.3.2.343.g7d43d

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux