From: Advait Dhamorikar <advaitdhamorikar@gmail.com>
To: alexander.deucher@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@gmail.com, simona@ffwll.ch,
leo.liu@amd.com, sathishkumar.sundararaju@amd.com,
saleemkhan.jamadar@amd.com, Veerabadhran.Gopalakrishnan@amd.com,
advaitdhamorikar@gmail.com, sonny.jiang@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, skhan@linuxfoundation.org,
anupnewsmail@gmail.com
Subject: [PATCH-next v2] Fix unintentional integer overflow
Date: Thu, 3 Oct 2024 15:56:23 +0530 [thread overview]
Message-ID: <20241003102623.11262-1-advaitdhamorikar@gmail.com> (raw)
Fix shift-count-overflow in JPEG instance
multiplication. The expression's value may not be
what the programmer intended, because the expression
is evaluated using a narrower integer type.
Fixes: f0b19b84d391 ("drm/amdgpu: add amdgpu_jpeg_sched_mask debugfs")
Signed-off-by: Advait Dhamorikar <advaitdhamorikar@gmail.com>
---
V1 -> V2: addressed review comments
drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
index 95e2796919fc..b6f0435f56ba 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_jpeg.c
@@ -357,7 +357,7 @@ static int amdgpu_debugfs_jpeg_sched_mask_set(void *data, u64 val)
if (!adev)
return -ENODEV;
- mask = (1 << (adev->jpeg.num_jpeg_inst * adev->jpeg.num_jpeg_rings)) - 1;
+ mask = ((uint64_t)1 << (adev->jpeg.num_jpeg_inst * adev->jpeg.num_jpeg_rings)) - 1;
if ((val & mask) == 0)
return -EINVAL;
--
2.34.1
next reply other threads:[~2024-10-03 10:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 10:26 Advait Dhamorikar [this message]
2024-10-03 10:44 ` Sundararaju, Sathishkumar
2024-10-03 21:22 ` Alex Deucher
2024-10-04 11:19 ` Lazar, Lijo
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=20241003102623.11262-1-advaitdhamorikar@gmail.com \
--to=advaitdhamorikar@gmail.com \
--cc=Veerabadhran.Gopalakrishnan@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=anupnewsmail@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=leo.liu@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=saleemkhan.jamadar@amd.com \
--cc=sathishkumar.sundararaju@amd.com \
--cc=simona@ffwll.ch \
--cc=skhan@linuxfoundation.org \
--cc=sonny.jiang@amd.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
all inboxes | Powered by JetHome®