drm/amdgpu: Fix out-of-bounds write warning
authorjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:16:02 +0000 (09:16 +0000)
committerjsg <jsg@openbsd.org>
Mon, 9 Sep 2024 09:16:02 +0000 (09:16 +0000)
From Ma Jun
a60d1f7ff62e453dde2d3b4907e178954d199844 in linux-6.6.y/6.6.50
be1684930f5262a622d40ce7a6f1423530d87f89 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_ring.c

index 0bedffc..f44b303 100644 (file)
@@ -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)++] =