[Intel-gfx] [PATCH] drivers/gpu/drm/i915/selftests/i915_buddy.c: Fix bug
Matthew Auld
matthew.william.auld at gmail.com
Thu Mar 26 17:04:43 UTC 2020
On Wed, 25 Mar 2020 at 21:23, George Spelvin <lkml at sdf.org> wrote:
>
> 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.
>
> Signed-off-by: George Spelvin <lkml at sdf.org>
> Fixes: 14d1b9a6247c
> Cc: Matthew Auld <matthew.auld at intel.com>
> Cc: Jani Nikula <jani.nikula at linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
> Cc: intel-gfx at lists.freedesktop.org
Reviewed-by: Matthew Auld <matthew.auld at intel.com>
More information about the Intel-gfx
mailing list