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 3BA333AEF4F; Mon, 23 Mar 2026 14:07:28 +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=1774274848; cv=none; b=njXwWXilkbwl8wOoFoDvH6SoT7P58tnVl1Dc5YuAz9FzzHVJi/b6fWIm7cWNkhAGkBbHevkDVPz1iYwDC8f4QU6Si8R4+wNJ3lBaEobOq91bIN24dizC4bQnb6hc/PY4xz6zdDRq1ivAnBOfY8gnHZcA/LVr3q5PPu2LGmwoWFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774274848; c=relaxed/simple; bh=bSlnFl9xpSVMsJhR4JOgIJjUsxyBORNfemUveAomOEE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hDiPO7gS8/djgEYwHLsFnIfTJN8lA3A4J9Ew74Gu/xZKYMWJSU1Zz23ADPpWfLeNjxNXEn5O0PiYlfSmrFHngZQKjhhbR1QWvcpbJSBQGGTYCv8BBUmBLNkEw178aH3Ans/EyVxmOnaMN81kcOIV6johVsUk1DlSNtDe8tZboxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=bYyuT3ov; 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="bYyuT3ov" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C01ABC2BC9E; Mon, 23 Mar 2026 14:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774274848; bh=bSlnFl9xpSVMsJhR4JOgIJjUsxyBORNfemUveAomOEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bYyuT3ovx/lk381ZV/Vaz4xBF0L40+I06iR6Rqe+0ykbpcvVAIftd6xAoNz32KqiM TEFq1KsAY46wRcpg6R9r5vJOR6UGxqtqX3ABgrZusu/2mCMPXXEiTIF5cODGmqJ/xW OIiNKSQbPPRY/MfJT6a6bI0kNpr+NvixmCmh84ns= 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 086/212] drm/amdgpu/mmhub3.0: add bounds checking for cid Date: Mon, 23 Mar 2026 14:45:07 +0100 Message-ID: <20260323134506.491869542@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 cdb82ecbeccb55fae75a3c956b605f7801a30db1 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 f14f27bbe2a3ed7af32d5f6eaf3f417139f45253) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v3_0.c @@ -110,7 +110,8 @@ mmhub_v3_0_print_l2_protection_fault_sta switch (amdgpu_ip_version(adev, MMHUB_HWIP, 0)) { case IP_VERSION(3, 0, 0): case IP_VERSION(3, 0, 1): - mmhub_cid = mmhub_client_ids_v3_0_0[cid][rw]; + mmhub_cid = cid < ARRAY_SIZE(mmhub_client_ids_v3_0_0) ? + mmhub_client_ids_v3_0_0[cid][rw] : NULL; break; default: mmhub_cid = NULL;