From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E05EF36F414; Mon, 23 Mar 2026 14:07:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274851; cv=none; b=Xx26qFWOynIgehSCo8ihwipd/mnvYUAcp2Qf1CQUqJjVTbsx6LKd3JDHHRBZWAxowp8EWGhkm0uWKRJ67JShv77Rf7fJimNUjLJMII51knLdEvop70nt1j3/D10ltzo6rd64ukfLqoWYlOfIBdgT9Nt81E6xYLZjTJeysVBdMhE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274851; c=relaxed/simple; bh=1jflw6anNIi0uB1OKlKGkgUKMpkFdQgphF2EXdC3o+4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qQ3HcQArXXB64eXmN7cTvs6CTdXvmhhfc1KsEdEbSoWew9IEotxeMc6Nbp9mkPavSffMyNbfmYNxS//BxdgprWCGDOSsvb3ILxDeZede4meRvYtTUR7moBYEXmCb2pwgvbYB+VxQiMEyRr/62lf66gXIeyyFOwnIaXGnsUN35bE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=k1JgP5qT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="k1JgP5qT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72025C4CEF7; Mon, 23 Mar 2026 14:07:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274850; bh=1jflw6anNIi0uB1OKlKGkgUKMpkFdQgphF2EXdC3o+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1JgP5qTiSdn3+9W2ZCkaaWAv3Ovg5fslgufn7YD9g4AJnjClqLp8jzR0ZCMKtXVr ipr+Zd4PjRxnve/nOBxPpXFlgrkqLFlz1QIFNZ6qliVroP/ESEqhHVQE5oxiRY9y/g 1bPl7ibHKXtmn2i7T/uclpLduYQR2KU6W/nZKZFw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Benjamin Cheng , Alex Deucher Subject: [PATCH 6.18 087/212] drm/amdgpu/mmhub4.1.0: add bounds checking for cid Date: Mon, 23 Mar 2026 14:45:08 +0100 Message-ID: <20260323134506.524235391@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134503.770111826@linuxfoundation.org> References: <20260323134503.770111826@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Deucher commit 3cdd405831d8cc50a5eae086403402697bb98a4a 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 Signed-off-by: Alex Deucher (cherry picked from commit 04f063d85090f5dd0c671010ce88ee49d9dcc8ed) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/mmhub_v4_1_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- 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_s 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;