[PATCH] Couple of sparse warning fixes in drivers/gpu/drm/radeon

Dr. David Alan Gilbert linux at treblig.org
Sun Aug 29 13:17:12 PDT 2010


Hi,
  This patch fixes a few warnings found with sparse; it should have
no functional change.   The change in radeon_cs.c just removes
a variable that was being assigned but never used, along the way causing a
warning.  The change in radeon_kms.c adds a couple of __user qualifiers
that cleans up some warnings and if present should have helped spot
the previously missing copy_from_user that went in previously.

Against 2.6.36-rc3

Signed-off-by: David Alan Gilbert <linux at treblig.org>
---
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index fcc79b5..f82fde7 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -120,7 +120,6 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 	for (i = 0; i < p->nchunks; i++) {
 		struct drm_radeon_cs_chunk __user **chunk_ptr = NULL;
 		struct drm_radeon_cs_chunk user_chunk;
-		uint32_t __user *cdata;
 
 		chunk_ptr = (void __user*)(unsigned long)p->chunks_array[i];
 		if (DRM_COPY_FROM_USER(&user_chunk, chunk_ptr,
@@ -144,7 +143,6 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
 		p->chunks[i].length_dw = user_chunk.length_dw;
 		p->chunks[i].user_ptr = (void __user *)(unsigned long)user_chunk.chunk_data;
 
-		cdata = (uint32_t *)(unsigned long)user_chunk.chunk_data;
 		if (p->chunks[i].chunk_id != RADEON_CHUNK_ID_IB) {
 			size = p->chunks[i].length_dw * sizeof(uint32_t);
 			p->chunks[i].kdata = kmalloc(size, GFP_KERNEL);
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
index 5eee3c4..0559077 100644
--- a/drivers/gpu/drm/radeon/radeon_kms.c
+++ b/drivers/gpu/drm/radeon/radeon_kms.c
@@ -105,13 +105,13 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 	struct radeon_device *rdev = dev->dev_private;
 	struct drm_radeon_info *info;
 	struct radeon_mode_info *minfo = &rdev->mode_info;
-	uint32_t *value_ptr;
+	uint32_t __user *value_ptr;
 	uint32_t value;
 	struct drm_crtc *crtc;
 	int i, found;
 
 	info = data;
-	value_ptr = (uint32_t *)((unsigned long)info->value);
+	value_ptr = (uint32_t __user *)((unsigned long)info->value);
 	if (DRM_COPY_FROM_USER(&value, value_ptr, sizeof(value)))
 		return -EFAULT;
 
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\ gro.gilbert @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/


More information about the dri-devel mailing list