Skip to content

Commit

Permalink
drm/amdgpu: Fix out-of-bounds write warning
Browse files Browse the repository at this point in the history
[ Upstream commit be16849 ]

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: Tim Huang <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Ma Jun authored and gregkh committed Sep 8, 2024
1 parent f71ef2b commit a60d1f7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)++] =
Expand Down

0 comments on commit a60d1f7

Please sign in to comment.