[Intel-gfx] [bug report] drm/i915: buddy allocator

Dan Carpenter dan.carpenter at oracle.com
Thu Aug 15 09:04:10 UTC 2019


Hello Matthew Auld,

The patch 14d1b9a6247c: "drm/i915: buddy allocator" from Aug 9, 2019,
leads to the following static checker warning:

	drivers/gpu/drm/i915/selftests/i915_buddy.c:670 igt_buddy_alloc_range()
	error: we previously assumed 'block' could be null (see line 665)

drivers/gpu/drm/i915/selftests/i915_buddy.c
   660                  }
   661  
   662                  block = list_first_entry_or_null(&tmp,
   663                                                   struct i915_buddy_block,
   664                                                   link);
   665                  if (!block) {
   666                          pr_err("alloc_range has no blocks\n");
   667                          err = -EINVAL;

No break statement?

   668                  }
   669  
   670                  if (i915_buddy_block_offset(block) != offset) {
   671                          pr_err("alloc_range start offset mismatch, found=%llx, expected=%llx\n",
   672                                 i915_buddy_block_offset(block), offset);
   673                          err = -EINVAL;

I guess we still want to splice this into the list even though it's
invalid?

   674                  }
   675  
   676                  if (!err)
   677                          err = igt_check_blocks(&mm, &tmp, size, true);

Same

   678  
   679                  list_splice_tail(&tmp, &blocks);
   680  
   681                  if (err)
   682                          break;
   683  
   684                  offset += size;
   685  
   686                  rem -= size;

regards,
dan carpenter


More information about the Intel-gfx mailing list