drm/amdgpu: add check for xcp id
Subsystems (2)
PATCH 1/1 drm/amdgpu: add check for xcp id
check sel_xcp_id before its use
Signed-off-by Gangliang Xie <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +3 -0
@@ -576,6 +576,9 @@ static void amdgpu_xcp_gpu_sched_update(struct amdgpu_device *adev, {unsigned int *num_gpu_sched; +if (sel_xcp_id >=MAX_XCP || sel_xcp_id ==AMDGPU_XCP_NO_PARTITION ) +return ; + num_gpu_sched = &adev->xcp_mgr->xcp[sel_xcp_id] .gpu_sched[ring->funcs->type][ring->hw_prio].num_scheds; adev->xcp_mgr->xcp[sel_xcp_id].gpu_sched[ring->funcs->type][ring->hw_prio]
Signature · 1 line
2.34.1
Quoted 3 lines · Gangliang Xie
check
sel_xcp_idbefore its useSigned-off-by Gangliang Xie <[email protected]>
Reviewed-by Lijo Lazar <[email protected]>
Thanks,
Lijo
Quoted 18 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c +3
-0@@ -576,6 +576,9 @@ static void amdgpu_xcp_gpu_sched_update(struct amdgpu_device *adev, {unsigned int *num_gpu_sched; +if (sel_xcp_id >=MAX_XCP || sel_xcp_id ==AMDGPU_XCP_NO_PARTITION ) +return ; + num_gpu_sched = &adev->xcp_mgr->xcp[sel_xcp_id] .gpu_sched[ring->funcs->type][ring->hw_prio].num_scheds; adev->xcp_mgr->xcp[sel_xcp_id].gpu_sched[ring->funcs->type][ring->hw_prio]