[PATCH v2] drm/amdgpu: Fix out-of-bounds write warning

Huang, Tim Tim.Huang at amd.com
Mon May 6 09:20:15 UTC 2024


[Public]

Reviewed-by: Tim Huang <Tim.Huang at amd.com>

Best Regards,
Tim Huang



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Ma Jun
> Sent: Monday, May 6, 2024 1:59 PM
> To: amd-gfx at lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig at amd.com>; Deucher, Alexander
> <Alexander.Deucher at amd.com>
> Cc: Ma, Jun <Jun.Ma2 at amd.com>
> Subject: [PATCH v2] drm/amdgpu: Fix out-of-bounds write warning
>
> Check the ring type value to fix the out-of-bounds write warning
>
> Signed-off-by: Ma Jun <Jun.Ma2 at amd.com>
> Suggested-by: Christian König <christian.koenig at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> index 15c240656470..ad49cecb20b8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
> @@ -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)++] =
> --
> 2.34.1



More information about the amd-gfx mailing list