drm/radeon: Only warn if the intra-domain offset actually exceeds the limit.

Dan Carpenter dan.carpenter at oracle.com
Thu Mar 29 05:06:32 PDT 2012


Hello Michel Dänzer,

This is a semi-automatic email about new static checker warnings.

The patch d936622c3627: "drm/radeon: Only warn if the intra-domain 
offset actually exceeds the limit." from Mar 28, 2012, leads to the 
following Smatch complaint:

drivers/gpu/drm/radeon/radeon_object.c:244 radeon_bo_pin_restricted()
	 error: we previously assumed 'gpu_addr' could be null (see line 234)

drivers/gpu/drm/radeon/radeon_object.c
   233			bo->pin_count++;
   234			if (gpu_addr)
                            ^^^^^^^^
Old check.

   235				*gpu_addr = radeon_bo_gpu_offset(bo);
   236	
   237			if (max_offset != 0) {
   238				u64 domain_start;
   239	
   240				if (domain == RADEON_GEM_DOMAIN_VRAM)
   241					domain_start = bo->rdev->mc.vram_start;
   242				else
   243					domain_start = bo->rdev->mc.gtt_start;
   244				WARN_ON_ONCE((*gpu_addr - domain_start) > max_offset);
                                              ^^^^^^^^^
New dereference.

   245			}
   246	

regards,
dan carpenter



More information about the dri-devel mailing list