]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Avoid mixing integer types during batch copies
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 28 Sep 2020 21:59:42 +0000 (22:59 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 29 Sep 2020 11:33:17 +0000 (12:33 +0100)
commit0899e745cfc6153a1c8311ca1cdf3f498eaca2b9
tree01d58f5b823240cecdcfad4bf8668bac63313e90
parent00904eaf528cbd395b77b02ff286598b73fac9ea
drm/i915: Avoid mixing integer types during batch copies

Be consistent and use unsigned long throughout the chunk copies to
avoid the inherent clumsiness of mixing integer types of different
widths and signs. Failing to take acount of a wider unsigned type when
using min_t can lead to treating it as a negative, only for it flip back
to a large unsigned value after passing a boundary check.

Fixes: a127a6321a96 ("drm/i915/cmdparser: Only cache the dst vmap")
Testcase: igt/gen9_exec_parse/bb-large
Reported-by: "Candelaria, Jared" <jared.candelaria@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: "Candelaria, Jared" <jared.candelaria@intel.com>
Cc: "Bloomfield, Jon" <jon.bloomfield@intel.com>
Cc: <stable@vger.kernel.org> # v4.9+
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200928215942.31917-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/i915_cmd_parser.c
drivers/gpu/drm/i915/i915_drv.h