From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 1/7] drm/amdgpu/mmhub2.0: add bounds checking for cid
Date: Wed, 4 Mar 2026 17:27:26 -0500 [thread overview]
Message-ID: <20260304222732.2403409-1-alexander.deucher@amd.com> (raw)
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) ?
+ 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;
--
2.53.0
next reply other threads:[~2026-03-04 22:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 22:27 Alex Deucher [this message]
2026-03-04 22:27 ` [PATCH 2/7] drm/amdgpu/mmhub2.3: add bounds checking for cid 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 ` [PATCH 1/7] drm/amdgpu/mmhub2.0: " Lazar, Lijo
2026-03-05 16:16 ` 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=20260304222732.2403409-1-alexander.deucher@amd.com \
--to=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