From: Nirmoy Das <nirmoy.das@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Nirmoy Das <nirmoy.das@intel.com>, Matthew Auld <matthew.auld@intel.com>
Subject: [PATCH 2/3] drm/xe: Fix potential integer overflow in page size calculation
Date: Thu, 14 Mar 2024 10:54:41 +0100 [thread overview]
Message-ID: <20240314095442.32153-2-nirmoy.das@intel.com> (raw)
In-Reply-To: <20240314095442.32153-1-nirmoy.das@intel.com>
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>
Signed-off-by: Nirmoy Das <nirmoy.das@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
next prev parent reply other threads:[~2024-03-14 10:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 9:54 [PATCH 1/3] drm/xe: Fix out-of-bounds warning in vm_bind_ioctl_check_args Nirmoy Das
2024-03-14 9:54 ` Nirmoy Das [this message]
2024-03-14 10:24 ` [PATCH 2/3] drm/xe: Fix potential integer overflow in page size calculation Matthew Auld
2024-03-14 9:54 ` [PATCH 3/3] drm/xe: Warn on NULL job when user fence used in xe_sync_entry_signal Nirmoy Das
2024-03-14 10:53 ` Matthew Auld
2024-03-16 1:28 ` Matthew Brost
2024-03-18 9:27 ` Nirmoy Das
2024-03-14 10:15 ` ✓ CI.Patch_applied: success for series starting with [1/3] drm/xe: Fix out-of-bounds warning in vm_bind_ioctl_check_args Patchwork
2024-03-14 10:15 ` ✓ CI.checkpatch: " Patchwork
2024-03-14 10:20 ` ✓ CI.KUnit: " Patchwork
2024-03-14 10:30 ` ✓ CI.Build: " Patchwork
2024-03-14 10:36 ` ✓ CI.Hooks: " Patchwork
2024-03-14 10:37 ` ✓ CI.checksparse: " Patchwork
2024-03-14 10:55 ` [PATCH 1/3] " Matthew Auld
2024-03-16 1:29 ` Matthew Brost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240314095442.32153-2-nirmoy.das@intel.com \
--to=nirmoy.das@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox