drm/amdgpu: Fix out-of-bounds write warning
Subsystems (2)
PATCH v2 1/1 drm/amdgpu: Fix out-of-bounds write warning
Check the ring type value to fix the out-of-bounds write warning
Signed-off-by Ma Jun <[email protected]>
Suggested-by Christian König <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
@@ -352,7 +352,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, ring->max_dw = max_dw; ring->hw_prio = hw_prio; -if (!ring->no_scheduler) { +if (!ring->no_scheduler && ring->funcs->type <AMDGPU_HW_IP_NUM ) { 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)++] =
Signature · 1 line
2.34.1
[Public]
Reviewed-by Tim Huang <[email protected]>
Best Regards,
Tim Huang
Quoted 35 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Ma Jun
Sent: Monday, May 6, 2024 1:59 PM
To: [email protected]; Koenig, Christian <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Ma, Jun <[email protected]>
Subject: [PATCH v2] drm/amdgpu: Fix out-of-bounds write warningCheck the ring type value to fix the out-of-bounds write warning
Signed-off-by Ma Jun <[email protected]>Suggested-by Christian König <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1
-1@@ -352,7 +352,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, ring->max_dw = max_dw; ring->hw_prio = hw_prio; -if (!ring->no_scheduler) { +if (!ring->no_scheduler && ring->funcs->type <AMDGPU_HW_IP_NUM ) { 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
Am 06.05.24 um 07:59 schrieb Ma Jun:
Quoted 5 lines
Check the ring type value to fix the out-of-bounds write warning
Signed-off-by Ma Jun <[email protected]>Suggested-by Christian König <[email protected]>
Reviewed-by Christian König <[email protected]>
Quoted 17 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1
-1@@ -352,7 +352,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, ring->max_dw = max_dw; ring->hw_prio = hw_prio; -if (!ring->no_scheduler) { +if (!ring->no_scheduler && ring->funcs->type <AMDGPU_HW_IP_NUM ) { 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)++] =