summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_reg.h
diff options
context:
space:
mode:
authorGeorge Spelvin <lkml@SDF.ORG>2020-03-25 19:24:29 +0000
committerRodrigo Vivi <rodrigo.vivi@intel.com>2020-08-17 16:16:54 -0400
commit21118e8e56479ef33460fbd63a5ad0535843b666 (patch)
tree520b12eb13c3a62ee9043628826cd617b2141b49 /drivers/gpu/drm/i915/i915_reg.h
parent13149e8bafc4657254831ba6c16ed8780aa64a06 (diff)
downloadlinux-stable-21118e8e56479ef33460fbd63a5ad0535843b666.tar.gz
linux-stable-21118e8e56479ef33460fbd63a5ad0535843b666.tar.bz2
linux-stable-21118e8e56479ef33460fbd63a5ad0535843b666.zip
drm/i915/selftests: Avoid passing a random 0 into ilog2
igt_mm_config() calls ilog2() on the (pseudo)random 21-bit number s>>12. Once in 2 million seeds, this is zero and ilog2 summons the nasal demons. There was an attempt to handle this case with a max(), but that's too late; ms could already be something bizarre. Given that the low 12 bits of s and ms are always zero, it's a lot simpler just to divide them by 4096, then everything fits into 32 bits, and we can easily generate a random number 1 <= s <= 0x1fffff. Fixes: 14d1b9a6247c ("drm/i915: buddy allocator") Signed-off-by: George Spelvin <lkml@sdf.org> Cc: Matthew Auld <matthew.auld@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: intel-gfx@lists.freedesktop.org Reviewed-by: Matthew Auld <matthew.auld@intel.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20200325192429.GA8865@SDF.ORG Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_reg.h')
0 files changed, 0 insertions, 0 deletions