DragonFlyBSD Kernel Audit
DF-1467 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/amdgpu/vi.c b/sys/dev/drm/amd/amdgpu/vi.c
--- a/sys/dev/drm/amd/amdgpu/vi.c
+++ b/sys/dev/drm/amd/amdgpu/vi.c
@@ -556,6 +556,10 @@
 		unsigned se_idx = (se_num == 0xffffffff) ? 0 : se_num;
 		unsigned sh_idx = (sh_num == 0xffffffff) ? 0 : sh_num;
 
+		if (se_idx >= AMDGPU_GFX_MAX_SE ||
+		    sh_idx >= AMDGPU_GFX_MAX_SH_PER_SE)
+			return 0;
+
 		switch (reg_offset) {
 		case mmCC_RB_BACKEND_DISABLE:
 			return adev->gfx.config.rb_config[se_idx][sh_idx].rb_backend_disable;