drm/xe: Fix potential integer overflow in page size calculation

[ Upstream commit 4f4fcafde343a54465f85a2909fc684918507a4b ]

Explicitly cast tbo->page_alignment to u64 before bit-shifting to
prevent overflow when assigning to min_page_size.

Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240318164342.3094-1-nirmoy.das@intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Nirmoy Das 2024-03-18 17:43:41 +01:00 committed by Greg Kroah-Hartman
parent e646402bf8
commit 79d54ddf0e

View File

@ -91,7 +91,7 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man,
min_page_size = mgr->default_page_size;
if (tbo->page_alignment)
min_page_size = tbo->page_alignment << PAGE_SHIFT;
min_page_size = (u64)tbo->page_alignment << PAGE_SHIFT;
if (WARN_ON(min_page_size < mm->chunk_size)) {
err = -EINVAL;