Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] drm/xe: Fix potential integer overflow in page size calculation
@ 2024-03-18 16:43 Nirmoy Das
  2024-03-18 16:43 ` [PATCH v2 2/2] drm/xe: Add a WARN_ON for NULL job in xe_sync_entry_signal Nirmoy Das
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Nirmoy Das @ 2024-03-18 16:43 UTC (permalink / raw)
  To: intel-xe; +Cc: Nirmoy Das, Matthew Auld, Matthew Brost

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>
---
 drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
index 115ec745e502..0678faf83212 100644
--- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
+++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
@@ -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;
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-02-10 18:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 16:43 [PATCH v2 1/2] drm/xe: Fix potential integer overflow in page size calculation Nirmoy Das
2024-03-18 16:43 ` [PATCH v2 2/2] drm/xe: Add a WARN_ON for NULL job in xe_sync_entry_signal Nirmoy Das
2024-03-18 17:03   ` Matthew Brost
2024-03-18 17:41   ` Michal Wajdeczko
2024-03-18 18:41     ` Nirmoy Das
2024-03-20  3:20       ` Lucas De Marchi
2024-03-20 13:07         ` Nirmoy Das
2025-02-10 18:05   ` Upadhyay, Tejas
2025-02-10 18:14     ` Upadhyay, Tejas
2024-03-18 22:50 ` ✓ CI.Patch_applied: success for series starting with [v2,1/2] drm/xe: Fix potential integer overflow in page size calculation Patchwork
2024-03-18 22:50 ` ✓ CI.checkpatch: " Patchwork
2024-03-18 22:51 ` ✓ CI.KUnit: " Patchwork
2024-03-18 23:01 ` ✓ CI.Build: " Patchwork
2024-03-18 23:04 ` ✓ CI.Hooks: " Patchwork
2024-03-18 23:05 ` ✓ CI.checksparse: " Patchwork
2024-03-18 23:27 ` ✓ CI.BAT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox