[PATCH 2/2] drm/amdgpu: fix mc_data out-of-bounds read warning
Alex Deucher
alexdeucher at gmail.com
Mon May 6 15:02:19 UTC 2024
On Mon, May 6, 2024 at 5:37 AM Tim Huang <Tim.Huang at amd.com> wrote:
>
> Clear warning that read mc_data[i-1] may out-of-bounds.
>
> Signed-off-by: Tim Huang <Tim.Huang at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> index 52b12c1718eb..7dc102f0bc1d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atombios.c
> @@ -1484,6 +1484,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.39.2
>
More information about the amd-gfx
mailing list