]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/i915/guc: prevent a possible int overflow in wq offsets
authorNikita Zhandarovich <n.zhandarovich@fintech.ru>
Thu, 25 Jul 2024 15:59:25 +0000 (08:59 -0700)
committerTvrtko Ursulin <tursulin@ursulin.net>
Tue, 10 Sep 2024 07:13:51 +0000 (08:13 +0100)
commitd3d37f74683e2f16f2635ee265884f7ca69350ae
tree9c0c5de7c7c47772ff0a6ec90dfffbe861c24abf
parentda3ea35007d0af457a0afc87e84fddaebc4e0b63
drm/i915/guc: prevent a possible int overflow in wq offsets

It may be possible for the sum of the values derived from
i915_ggtt_offset() and __get_parent_scratch_offset()/
i915_ggtt_offset() to go over the u32 limit before being assigned
to wq offsets of u64 type.

Mitigate these issues by expanding one of the right operands
to u64 to avoid any overflow issues just in case.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: c2aa552ff09d ("drm/i915/guc: Add multi-lrc context registration")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: John Harrison <John.C.Harrison@Intel.com>
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://patchwork.freedesktop.org/patch/msgid/20240725155925.14707-1-n.zhandarovich@fintech.ru
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 1f1c1bd56620b80ae407c5790743e17caad69cec)
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c