From 67030a61d5fb14157d19243ad804b18207c23c96 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Fri, 18 Jul 2003 18:33:39 -0700 Subject: [PATCH] [PATCH] janitor: copy_to_user in media/video/pms From: Daniele Bellucci Add a status check to copy_to_user() in a media/video driver. --- drivers/media/video/pms.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 952b0b9865e17..f8df5e1d669fe 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c @@ -12,6 +12,10 @@ * Most of this code is directly derived from his userspace driver. * His driver works so send any reports to alan@redhat.com unless the * userspace driver also doesn't work for you... + * + * Changes: + * 08/07/2003 Daniele Bellucci + * - pms_capture: report back -EFAULT */ #include @@ -659,7 +663,8 @@ static int pms_capture(struct pms_device *dev, char *buf, int rgb555, int count) if(dt+len>count) dt=count-len; cnt += dev->height; - copy_to_user(buf, tmp+32, dt); + if (copy_to_user(buf, tmp+32, dt)) + return -EFAULT; buf += dt; len += dt; } -- 2.53.0