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 1D890156225; Thu, 5 Sep 2024 09:56:23 +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=1725530183; cv=none; b=UiinZDtugk04EiUbfwYyTmiSN+Bgqmyq5OjiZCBFWpe72oLeWnq0/mJlXXzE9+BSkodJmOXLvpkpRPs1sS1TUXZAE31TjjpRC8e+9AQk7c3VRz8Ilnl4Xjgr2UE+avAkClfBEZjBp9IBIIM1E02j86kKjYa2NulSI45PXR4XAGI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725530183; c=relaxed/simple; bh=P7tsCFAu6nDC5OR7aydgx8G4PuT1BJ0V/+qByE3tN2A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=immCJgMNq+SUZOuiUiTJ12SfEIdt+9hyC3rMfBIKJpTkMVpFDUv2OT9rhnRmmMtYcE+1+MXWTlKV9E7DfE9m74SIPvAqxzVCt4SJ1uSfzcRsl7Oge11W31TNdzSuHm8ADbn1a1DRWuDqgEMU4+2L0jBh5EYG7qEMG5/YZsFPzLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=G8BAlA//; 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="G8BAlA//" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BA4AC4CEC3; Thu, 5 Sep 2024 09:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725530183; bh=P7tsCFAu6nDC5OR7aydgx8G4PuT1BJ0V/+qByE3tN2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G8BAlA//kxAIlNM1QmL7ohXbdnrnmmOqh2V2YafxcRBeFUTWAsK+oAec1zpwb5Ex0 WDzwTrjxwWBXcXG9iYM5/t4Q1c6k3/xpg7cEPTrpVDjBw/0zaGRJHM5HKMOpyAAQu6 diI99j757fgaVT3N1LgwKSwkD6JOXCUtC3vMYQ88= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Hung , Tom Chung , Hersen Wu , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.6 062/132] drm/amd/display: Skip inactive planes within ModeSupportAndSystemConfiguration Date: Thu, 5 Sep 2024 11:40:49 +0200 Message-ID: <20240905093724.667145947@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240905093722.230767298@linuxfoundation.org> References: <20240905093722.230767298@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c b/drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.c index 9a3ded311195..85453bbb4f9b 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 @@ -1099,8 +1099,13 @@ void ModeSupportAndSystemConfiguration(struct display_mode_lib *mode_lib) // Total Available Pipes Support Check for (k = 0; k < mode_lib->vba.NumberOfActivePlanes; ++k) { - total_pipes += mode_lib->vba.DPPPerPlane[k]; pipe_idx = get_pipe_idx(mode_lib, k); + if (pipe_idx == -1) { + ASSERT(0); + continue; // skip inactive planes + } + total_pipes += mode_lib->vba.DPPPerPlane[k]; + if (mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz > 0.0) mode_lib->vba.DPPCLK[k] = mode_lib->vba.cache_pipes[pipe_idx].clks_cfg.dppclk_mhz; else -- 2.43.0