All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH][19/26] drivers/video/kyro/* - compile warning cleanup
@ 2005-02-10 21:34 Stephen Biggs
  2005-02-11  6:20 ` Alexey Dobriyan
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Biggs @ 2005-02-10 21:34 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Mail message body --]
[-- Type: text/plain, Size: 2213 bytes --]

Description: compile warning cleanup - handle copy_to/from_user error 
returns

Signed-off-by: Stephen Biggs <yrgrknmxpzlk@gawab.com>

diff -Nurdp -X dontdiff-osdl linux-2.6.11-rc3-mm-original/drivers/video/kyro/fbdev.c linux-2.6.11-rc3-mm/drivers/video/kyro/fbdev.c
--- linux-2.6.11-rc3-mm-original/drivers/video/kyro/fbdev.c	2005-02-07 16:32:21.000000000 +0200
+++ linux-2.6.11-rc3-mm/drivers/video/kyro/fbdev.c	2005-02-08 18:40:40.000000000 +0200
@@ -596,7 +596,10 @@ static int kyrofb_ioctl(struct inode *in
 
 	switch (cmd) {
 	case KYRO_IOCTL_OVERLAY_CREATE:
-		copy_from_user(&ol_create, argp, sizeof(overlay_create));
+		if (copy_from_user(&ol_create, argp, sizeof(overlay_create))) {
+			printk(KERN_ERR "copy_from_user failed!\n");
+			return -EFAULT;
+		}
 
 		if (kyro_dev_overlay_create(ol_create.ulWidth,
 					    ol_create.ulHeight, 0) < 0) {
@@ -606,8 +609,11 @@ static int kyrofb_ioctl(struct inode *in
 		}
 		break;
 	case KYRO_IOCTL_OVERLAY_VIEWPORT_SET:
-		copy_from_user(&ol_viewport_set, argp,
-			       sizeof(overlay_viewport_set));
+		if (copy_from_user(&ol_viewport_set, argp,
+			       sizeof(overlay_viewport_set))) {
+			printk(KERN_ERR "copy_from_user failed!\n");
+			return -EFAULT;
+		}
 
 		if (kyro_dev_overlay_viewport_set(ol_viewport_set.xOrgin,
 						  ol_viewport_set.yOrgin,
@@ -627,13 +633,22 @@ static int kyrofb_ioctl(struct inode *in
 		}
 		break;
 	case KYRO_IOCTL_UVSTRIDE:
-		copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long));
+		if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long))) {
+			printk(KERN_ERR "copy_to_user failed!\n");
+			return -EFAULT;
+		}
 		break;
 	case KYRO_IOCTL_STRIDE:
-		copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long));
+		if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long))) {
+			printk(KERN_ERR "copy_to_user failed!\n");
+			return -EFAULT;
+		}
 		break;
 	case KYRO_IOCTL_OVERLAY_OFFSET:
-		copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long));
+		if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long))) {
+			printk(KERN_ERR "copy_to_user failed!\n");
+			return -EFAULT;
+		}
 		break;
 	}
 




[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [KJ] [PATCH][19/26] drivers/video/kyro/* - compile warning cleanup
  2005-02-10 21:34 [KJ] [PATCH][19/26] drivers/video/kyro/* - compile warning cleanup Stephen Biggs
@ 2005-02-11  6:20 ` Alexey Dobriyan
  0 siblings, 0 replies; 2+ messages in thread
From: Alexey Dobriyan @ 2005-02-11  6:20 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]

On Thursday 10 February 2005 23:34, Stephen Biggs wrote:

> --- linux-2.6.11-rc3-mm-original/drivers/video/kyro/fbdev.c
> +++ linux-2.6.11-rc3-mm/drivers/video/kyro/fbdev.c

> -		copy_from_user(&ol_create, argp, sizeof(overlay_create));
> +		if (copy_from_user(&ol_create, argp, sizeof(overlay_create))) {
> +			printk(KERN_ERR "copy_from_user failed!\n");

Forgotten "Kyro FB: " prefix.

> -		copy_from_user(&ol_viewport_set, argp,
> -			       sizeof(overlay_viewport_set));
> +		if (copy_from_user(&ol_viewport_set, argp,
> +			       sizeof(overlay_viewport_set))) {
> +			printk(KERN_ERR "copy_from_user failed!\n");

> -		copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long));
> +		if (copy_to_user(argp, &deviceInfo.ulOverlayUVStride, sizeof(unsigned long))) {
> +			printk(KERN_ERR "copy_to_user failed!\n");

> -		copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long));
> +		if (copy_to_user(argp, &deviceInfo.ulOverlayStride, sizeof(unsigned long))) {
> +			printk(KERN_ERR "copy_to_user failed!\n");

> -		copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long));
> +		if (copy_to_user(argp, &deviceInfo.ulOverlayOffset, sizeof(unsigned long))) {
> +			printk(KERN_ERR "copy_to_user failed!\n");

	Alexey

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-02-11  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-10 21:34 [KJ] [PATCH][19/26] drivers/video/kyro/* - compile warning cleanup Stephen Biggs
2005-02-11  6:20 ` Alexey Dobriyan

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.