DragonFlyBSD Kernel Audit
DF-1403 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/drm/amd/amdgpu/cik.c b/sys/dev/drm/amd/amdgpu/cik.c
--- a/sys/dev/drm/amd/amdgpu/cik.c
+++ b/sys/dev/drm/amd/amdgpu/cik.c
@@ -1032,6 +1032,9 @@
 		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;