mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH-next v2] Fix unintentional integer overflow
@ 2024-10-03 10:26 Advait Dhamorikar
  2024-10-03 10:44 ` Sundararaju, Sathishkumar
  2024-10-04 11:19 ` Lazar, Lijo
  0 siblings, 2 replies; 4+ messages in thread
From: Advait Dhamorikar @ 2024-10-03 10:26 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, Xinhui.Pan, airlied, simona,
	leo.liu, sathishkumar.sundararaju, saleemkhan.jamadar,
	Veerabadhran.Gopalakrishnan, advaitdhamorikar, sonny.jiang
  Cc: amd-gfx, dri-devel, linux-kernel, skhan, anupnewsmail

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


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

end of thread, other threads:[~2024-10-04 11:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-03 10:26 [PATCH-next v2] Fix unintentional integer overflow Advait Dhamorikar
2024-10-03 10:44 ` Sundararaju, Sathishkumar
2024-10-03 21:22   ` Alex Deucher
2024-10-04 11:19 ` Lazar, Lijo

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®