From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/7] drm/amdgpu/mmhub2.0: add bounds checking for cid
Date: Thu, 5 Mar 2026 20:37:31 +0530 [thread overview]
Message-ID: <42e624f7-5190-49b4-95c4-dc22a6ba1ab8@amd.com> (raw)
In-Reply-To: <20260304222732.2403409-1-alexander.deucher@amd.com>
On 05-Mar-26 3:57 AM, Alex Deucher wrote:
> The value should never exceed the array size as those
> are the only values the hardware is expected to return,
> but add checks anyway.
>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> index a0cc8e218ca1e..534cb4c544dc4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v2_0.c
> @@ -154,14 +154,17 @@ mmhub_v2_0_print_l2_protection_fault_status(struct amdgpu_device *adev,
> switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) {
> case IP_VERSION(2, 0, 0):
> case IP_VERSION(2, 0, 2):
> - mmhub_cid = mmhub_client_ids_navi1x[cid][rw];
> + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_navi1x) ?
Does this introduce speculation and requirement to use array_index_nospec?
Thanks,
Lijo
> + mmhub_client_ids_navi1x[cid][rw] : NULL;
> break;
> case IP_VERSION(2, 1, 0):
> case IP_VERSION(2, 1, 1):
> - mmhub_cid = mmhub_client_ids_sienna_cichlid[cid][rw];
> + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_sienna_cichlid) ?
> + mmhub_client_ids_sienna_cichlid[cid][rw] : NULL;
> break;
> case IP_VERSION(2, 1, 2):
> - mmhub_cid = mmhub_client_ids_beige_goby[cid][rw];
> + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_beige_goby) ?
> + mmhub_client_ids_beige_goby[cid][rw] : NULL;
> break;
> default:
> mmhub_cid = NULL;
next prev parent reply other threads:[~2026-03-05 15:07 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 22:27 [PATCH 1/7] drm/amdgpu/mmhub2.0: add bounds checking for cid Alex Deucher
2026-03-04 22:27 ` [PATCH 2/7] drm/amdgpu/mmhub2.3: " Alex Deucher
2026-03-04 22:27 ` [PATCH 3/7] drm/amdgpu/mmhub3.0.1: " Alex Deucher
2026-03-04 22:27 ` [PATCH 4/7] drm/amdgpu/mmhub3.0.2: " Alex Deucher
2026-03-04 22:27 ` [PATCH 5/7] drm/amdgpu/mmhub3.0: " Alex Deucher
2026-03-04 22:27 ` [PATCH 6/7] drm/amdgpu/mmhub4.1.0: " Alex Deucher
2026-03-04 22:27 ` [PATCH 7/7] drm/amdgpu/mmhub4.2.0: " Alex Deucher
2026-03-05 15:07 ` Lazar, Lijo [this message]
2026-03-05 16:16 ` [PATCH 1/7] drm/amdgpu/mmhub2.0: " Alex Deucher
2026-03-16 17:56 ` Alex Deucher
2026-03-16 19:20 ` Benjamin Cheng
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=42e624f7-5190-49b4-95c4-dc22a6ba1ab8@amd.com \
--to=lijo.lazar@amd.com \
--cc=alexander.deucher@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