On 23-Jun-26 8:18 AM, Gangliang Xie wrote:
check sel_xcp_id before its use

Signed-off-by: Gangliang Xie <[email protected]>

Reviewed-by: Lijo Lazar <[email protected]>

Thanks,
Lijo

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
index 88e6eab91bc6..39416ff7386e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xcp.c
@@ -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]

Reply via email to