AMD-GFX Archive mirror
 help / color / mirror / Atom feed
From: "Huang, Tim" <Tim.Huang@amd.com>
To: "Ma, Jun" <Jun.Ma2@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"Koenig, Christian" <Christian.Koenig@amd.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Cc: "Ma, Jun" <Jun.Ma2@amd.com>
Subject: RE: [PATCH] drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number
Date: Tue, 7 May 2024 03:37:54 +0000	[thread overview]
Message-ID: <CH3PR12MB8074F990461379B8405257FAF6E42@CH3PR12MB8074.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240507031849.269814-1-Jun.Ma2@amd.com>

[Public]

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

Best Regards,
Tim Huang



> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Ma Jun
> Sent: Tuesday, May 7, 2024 11:19 AM
> To: amd-gfx@lists.freedesktop.org; Koenig, Christian
> <Christian.Koenig@amd.com>; Deucher, Alexander
> <Alexander.Deucher@amd.com>
> Cc: Ma, Jun <Jun.Ma2@amd.com>
> Subject: [PATCH] drm/amdgpu: Fix out-of-bounds read of
> df_v1_7_channel_number
>
> Check the fb_channel_number range to avoid the array out-of-bounds read error
>
> Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/df_v1_7.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> index 5dfab80ffff2..cd298556f7a6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> +++ b/drivers/gpu/drm/amd/amdgpu/df_v1_7.c
> @@ -70,6 +70,8 @@ static u32 df_v1_7_get_hbm_channel_number(struct
> amdgpu_device *adev)
>       int fb_channel_number;
>
>       fb_channel_number = adev->df.funcs->get_fb_channel_number(adev);
> +     if (fb_channel_number >= ARRAY_SIZE(df_v1_7_channel_number))
> +             fb_channel_number = 0;
>
>       return df_v1_7_channel_number[fb_channel_number];
>  }
> --
> 2.34.1


      reply	other threads:[~2024-05-07  3:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  3:18 [PATCH] drm/amdgpu: Fix out-of-bounds read of df_v1_7_channel_number Ma Jun
2024-05-07  3:37 ` Huang, Tim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CH3PR12MB8074F990461379B8405257FAF6E42@CH3PR12MB8074.namprd12.prod.outlook.com \
    --to=tim.huang@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Christian.Koenig@amd.com \
    --cc=Jun.Ma2@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).