[PATCH] drm/radeon: Don't dereference possibly-NULL pointer.

Michel Dänzer michel at daenzer.net
Thu Mar 29 07:47:43 PDT 2012


From: Michel Dänzer <michel.daenzer at amd.com>

Reported-by: Dan Carpenter <dan.carpenter at oracle.com>
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---

Third time's the charm, I hope...

 drivers/gpu/drm/radeon/radeon_object.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index ad9d450..028fcf3 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -241,7 +241,8 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,
 				domain_start = bo->rdev->mc.vram_start;
 			else
 				domain_start = bo->rdev->mc.gtt_start;
-			WARN_ON_ONCE((*gpu_addr - domain_start) > max_offset);
+			WARN_ON_ONCE(max_offset <
+				     (radeon_bo_gpu_offset(bo) - domain_start));
 		}
 
 		return 0;
-- 
1.7.9.1



More information about the dri-devel mailing list