Skip to content
/ linux Public

Commit 603db8a

Browse files
alexdeuchergregkh
authored andcommitted
drm/amdgpu/mmhub2.3: add bounds checking for cid
commit a54403a upstream. The value should never exceed the array size as those are the only values the hardware is expected to return, but add checks anyway. Reviewed-by: Benjamin Cheng <benjamin.cheng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 89cd90375c19fb45138990b70e9f4ba4806f05c4) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2c4eea0 commit 603db8a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/amdgpu/mmhub_v2_3.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ mmhub_v2_3_print_l2_protection_fault_status(struct amdgpu_device *adev,
9494
case IP_VERSION(2, 3, 0):
9595
case IP_VERSION(2, 4, 0):
9696
case IP_VERSION(2, 4, 1):
97-
mmhub_cid = mmhub_client_ids_vangogh[cid][rw];
97+
mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_vangogh) ?
98+
mmhub_client_ids_vangogh[cid][rw] : NULL;
9899
break;
99100
default:
100101
mmhub_cid = NULL;

0 commit comments

Comments
 (0)