From 35f8aaf19f6501df0c1ba81900e897e4bd3fd708 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 9 Sep 2024 09:24:57 +0000 Subject: [PATCH] drm/amdgpu: fix mc_data out-of-bounds read warning From Tim Huang d0a43bf367ed640e527e8ef3d53aac1e71f80114 in linux-6.6.y/6.6.50 51dfc0a4d609fe700750a62f41447f01b8c9ea50 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_atombios.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_atombios.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_atombios.c index 87bfccd0d2d..335dc81b5c2 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_atombios.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_atombios.c @@ -1476,6 +1476,8 @@ int amdgpu_atombios_init_mc_reg_table(struct amdgpu_device *adev, (u32)le32_to_cpu(*((u32 *)reg_data + j)); j++; } else if ((reg_table->mc_reg_address[i].pre_reg_data & LOW_NIBBLE_MASK) == DATA_EQU_PREV) { + if (i == 0) + continue; reg_table->mc_reg_table_entry[num_ranges].mc_data[i] = reg_table->mc_reg_table_entry[num_ranges].mc_data[i - 1]; } -- 2.20.1