All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: Fix out-of-bounds write warning
@ 2024-04-25 10:00 Ma Jun
  2024-04-25 10:00 ` [PATCH v2 1/2] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr Ma Jun
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ma Jun @ 2024-04-25 10:00 UTC (permalink / raw)
  To: amd-gfx, christian.koenig, Alexander.Deucher; +Cc: Ma Jun

Check the ring type value to fix the out-of-bounds
write warning

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
index 06f0a6534a94..1e0b5bb47bc9 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
@@ -353,6 +353,11 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 	ring->hw_prio = hw_prio;
 
 	if (!ring->no_scheduler) {
+		if (ring->funcs->type >= AMDGPU_HW_IP_NUM) {
+			dev_warn(adev->dev, "ring type %d has no scheduler\n", ring->funcs->type);
+			return 0;
+		}
+
 		hw_ip = ring->funcs->type;
 		num_sched = &adev->gpu_sched[hw_ip][hw_prio].num_scheds;
 		adev->gpu_sched[hw_ip][hw_prio].sched[(*num_sched)++] =
-- 
2.34.1


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

end of thread, other threads:[~2024-04-26  7:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-25 10:00 [PATCH] drm/amdgpu: Fix out-of-bounds write warning Ma Jun
2024-04-25 10:00 ` [PATCH v2 1/2] drm/amdgpu: Fix uninitialized variable warning in amdgpu_afmt_acr Ma Jun
2024-04-25 13:14   ` Alex Deucher
2024-04-25 10:00 ` [PATCH v2 2/2] drm/amdgpu: Fix the uninitialized variable warning Ma Jun
2024-04-25 10:10   ` Lazar, Lijo
2024-04-26  3:08     ` Ma, Jun
2024-04-25 13:12   ` Alex Deucher
2024-04-25 12:39 ` [PATCH] drm/amdgpu: Fix out-of-bounds write warning Christian König
2024-04-26  3:24   ` Ma, Jun
2024-04-26  7:38     ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.