From nobody Mon Feb 9 08:39:21 2026 Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) (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 4AB8E251781; Tue, 8 Apr 2025 00:44:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.166.238 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744073077; cv=none; b=OP0GumHHAS/tRVfIcZL+CUtuRzKwbbBwo7hJhoHjuFTiGyggpge63Zla1gGKLtS7vPjk8EgdUQ2mwX2wnC0Xe+Qua9f26eNQudTkuXgwOnCFg9WItqFEa74RKiidmb8dzZi5csXTDize/1fqL7xW5/PK6QqcgPh/pWP7oAzPTyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744073077; c=relaxed/simple; bh=S3SGrYifd/kPTZhcaYJg2O1Ffx5KNM2OkPbkjCq3/xo=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=d8XUMbon0ncnKLqm3L01i9lgH35qgplKqbVdz7inTMWVgBaDx8y7YanwQcE2DZrHsKSEyetbwOc3ljwmByXMSR4xvD9eLXmOjuFhry2mh28qtWL9dc6+wzJJUDcYfvUxdtubDrzSzD12VuvxG88M4LBpvxpmJVfJghY45LlqAgI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com; spf=pass smtp.mailfrom=windriver.com; arc=none smtp.client-ip=205.220.166.238 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=windriver.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=windriver.com Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5380c1mS014981; Mon, 7 Apr 2025 17:44:05 -0700 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 45tyt4auy7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Mon, 07 Apr 2025 17:44:05 -0700 (PDT) Received: from ala-exchng01.corp.ad.wrs.com (147.11.82.252) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Mon, 7 Apr 2025 17:44:04 -0700 Received: from pek-lpg-core1.wrs.com (147.11.136.210) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Mon, 7 Apr 2025 17:44:00 -0700 From: To: CC: , , , , , , , , , , , , , , , , , Subject: [PATCH 5.15.y] drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration Date: Tue, 8 Apr 2025 08:43:59 +0800 Message-ID: <20250408004359.3361615-1-jianqi.ren.cn@windriver.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: 16JNChR1K2X632q4hsA7As2mDto1yWOU X-Authority-Analysis: v=2.4 cv=RMSzH5i+ c=1 sm=1 tr=0 ts=67f47155 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=XR8D0OoHHMoA:10 a=zd2uoN0lAAAA:8 a=t7CeM3EgAAAA:8 a=jWJrOWpaenu_S2W2EP4A:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-GUID: 16JNChR1K2X632q4hsA7As2mDto1yWOU X-Sensitive_Customer_Information: Yes X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-07_07,2025-04-07_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 priorityscore=1501 adultscore=0 clxscore=1011 bulkscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.21.0-2502280000 definitions=main-2504080003 Content-Type: text/plain; charset="utf-8" From: Hersen Wu [ Upstream commit a54f7e866cc73a4cb71b8b24bb568ba35c8969df ] [Why] Coverity reports Memory - illegal accesses. [How] Skip inactive planes. Reviewed-by: Alex Hung Acked-by: Tom Chung Signed-off-by: Hersen Wu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher [get_pipe_idx() was introduced as a helper by dda4fb85e433 ("drm/amd/display: DML changes for DCN32/321") in v6.0. This patch backports it to make code clearer. And minor conflict is resolved due to code context change.] Signed-off-by: Jianqi Ren Signed-off-by: He Zhe --- Verified the build test --- .../drm/amd/display/dc/dml/display_mode_vba.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c b/driver= s/gpu/drm/amd/display/dc/dml/display_mode_vba.c index 0fad15020c74..2beca0b06925 100644 --- a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c +++ b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c @@ -867,11 +867,30 @@ static unsigned int CursorBppEnumToBits(enum cursor_b= pp ebpp) } } =20 +static unsigned int get_pipe_idx(struct display_mode_lib *mode_lib, unsign= ed int plane_idx) +{ + int pipe_idx =3D -1; + int i; + + ASSERT(plane_idx < DC__NUM_DPP__MAX); + + for (i =3D 0; i < DC__NUM_DPP__MAX ; i++) { + if (plane_idx =3D=3D mode_lib->vba.pipe_plane[i]) { + pipe_idx =3D i; + break; + } + } + ASSERT(pipe_idx >=3D 0); + + return pipe_idx; +} + void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib) { soc_bounding_box_st *soc =3D &mode_lib->vba.soc; unsigned int k; unsigned int total_pipes =3D 0; + unsigned int pipe_idx =3D 0; =20 mode_lib->vba.VoltageLevel =3D mode_lib->vba.cache_pipes[0].clks_cfg.volt= age; mode_lib->vba.ReturnBW =3D mode_lib->vba.ReturnBWPerState[mode_lib->vba.V= oltageLevel][mode_lib->vba.maxMpcComb]; @@ -892,6 +911,11 @@ void ModeSupportAndSystemConfiguration(struct display_= mode_lib *mode_lib) =20 // Total Available Pipes Support Check for (k =3D 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) { + pipe_idx =3D get_pipe_idx(mode_lib, k); + if (pipe_idx =3D=3D -1) { + ASSERT(0); + continue; // skip inactive planes + } total_pipes +=3D mode_lib->vba.DPPPerPlane[k]; } ASSERT(total_pipes <=3D DC__NUM_DPP__MAX); --=20 2.34.1