[PATCH] copy_to_user return value checking in radeon_state.c::radeon_cp_dispatch_texture() ...

DORMANTno replies

From: Jesper Juhl <hidden>
Date: 2004-11-28 18:25:28
Also in: lkml

Here's a patch adding return value checking to 
drivers/char/drm/radeon_state.c::radeon_cp_dispatch_texture()
thus getting rid of the warning 
drivers/char/drm/radeon_state.c: In function `radeon_cp_dispatch_texture':
drivers/char/drm/radeon_state.c:1443: warning: ignoring return value of `copy_to_user', declared with attribute warn_unused_result
and hopefully behaving more correctly in the case of errors.

<disclaimer>
I have no hardware to test this, so cmpile tested only.
</disclaimer>


Signed-off-by: Jesper Juhl <redacted>

diff -up linux-2.6.10-rc2-bk11-orig/drivers/char/drm/radeon_state.c linux-2.6.10-rc2-bk11/drivers/char/drm/radeon_state.c
--- linux-2.6.10-rc2-bk11-orig/drivers/char/drm/radeon_state.c	2004-10-18 23:54:55.000000000 +0200
+++ linux-2.6.10-rc2-bk11/drivers/char/drm/radeon_state.c	2004-11-28 19:25:16.000000000 +0100
@@ -1440,7 +1440,10 @@ static int radeon_cp_dispatch_texture( D
 		}
 		if ( !buf ) {
 			DRM_DEBUG("radeon_cp_dispatch_texture: EAGAIN\n");
-			DRM_COPY_TO_USER( tex->image, image, sizeof(*image) );
+			if (DRM_COPY_TO_USER( tex->image, image, sizeof(*image) )) {
+                        	DRM_ERROR( "copy_to_user\n" );
+				return DRM_ERR(EFAULT);
+			}
 			return DRM_ERR(EAGAIN);
 		}
 

PS. Please CC me on replies from other lists than linux-kernel.

-- 
Jesper Juhl [off-list ref]
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help