From: Alex Deucher <alexander.deucher@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Subject: [PATCH 6/7] drm/amdgpu/mmhub4.1.0: add bounds checking for cid
Date: Wed, 4 Mar 2026 17:27:31 -0500 [thread overview]
Message-ID: <20260304222732.2403409-6-alexander.deucher@amd.com> (raw)
In-Reply-To: <20260304222732.2403409-1-alexander.deucher@amd.com>
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_v4_1_0.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c b/drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c
index 951998454b257..88bfe321f83aa 100644
--- a/drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c
@@ -102,7 +102,8 @@ mmhub_v4_1_0_print_l2_protection_fault_status(struct amdgpu_device *adev,
status);
switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) {
case IP_VERSION(4, 1, 0):
- mmhub_cid = mmhub_client_ids_v4_1_0[cid][rw];
+ mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_v4_1_0) ?
+ mmhub_client_ids_v4_1_0[cid][rw] : NULL;
break;
default:
mmhub_cid = NULL;
--
2.53.0
next prev parent 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 [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 ` Alex Deucher [this message]
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-6-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