lkml.org 
[lkml]   [2004]   [Nov]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] copy_to_user return value checking in radeon_state.c::radeon_cp_dispatch_texture() ...

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 <juhl-lkml@dif.dk>

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 <juhl-lkml@dif.dk>



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.032 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site