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 F31CC18BC28; Tue, 10 Sep 2024 09:47:29 +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=1725961650; cv=none; b=IgJmQ4LMAK3doU/uHX682thz/qtV1z2EiR2zvmyBkIVB+1p+VusSe7R4QQGoCoGlihN8BrGJLZBzzXiU1qvP/v7JZDz9rkicIupyN/WuA3ehf2BwG8N+IzuQuGmNo+2UlbzdqdPNTzxM8KtJlRqTD9NW0Bx6wgyod9G2lh6J4S8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725961650; c=relaxed/simple; bh=EFtpDALpUal00wEiQAYj28G51tWySXFKJCJVTHZAru8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rk++pIFKr4DBWqSpZHzNoj8xwjnVqK/d56nWpi4FMBFmRn8Dp8o/PvSeQCYVKEQMDL/GweT6he7G9aPVZmwiWzbIR4ugp6i1hgV7VtWBzlZwZdUFVUy4vFZ7O7ps7JgZTEDley1Zbo+QxDyRSF7OB6b8uJLwSkJa4npKDQtpWJo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eWNzcbDU; 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="eWNzcbDU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3538AC4CEC3; Tue, 10 Sep 2024 09:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1725961649; bh=EFtpDALpUal00wEiQAYj28G51tWySXFKJCJVTHZAru8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eWNzcbDURR4W8U8l0opWbWYReNeyfdoiW7Zzf90uJ/4/bWrfn9589GK3keMipDFRu oQ4uSOAVZZ6/BRdtVcJZx9JWUSyqLfCr8eTEp0wLvgiwhaeoZj3f/vNFgG2lA2GTkw QCTWrYhY3wKXSHSNA0YYm0unR7sFY7LIP7HY0XLA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Harry Wentland , Jerry Zuo , Alex Hung , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 6.10 142/375] drm/amd/display: Check denominator crb_pipes before used Date: Tue, 10 Sep 2024 11:28:59 +0200 Message-ID: <20240910092627.239449354@linuxfoundation.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240910092622.245959861@linuxfoundation.org> References: <20240910092622.245959861@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.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Hung [ Upstream commit ea79068d4073bf303f8203f2625af7d9185a1bc6 ] [WHAT & HOW] A denominator cannot be 0, and is checked before used. This fixes 2 DIVIDE_BY_ZERO issues reported by Coverity. Reviewed-by: Harry Wentland Signed-off-by: Jerry Zuo Signed-off-by: Alex Hung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- .../gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c index 4ce0f4bf1d9b..3329eaecfb15 100644 --- a/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +++ b/drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c @@ -1756,7 +1756,7 @@ static int dcn315_populate_dml_pipes_from_context( bool split_required = pipe->stream->timing.pix_clk_100hz >= dcn_get_max_non_odm_pix_rate_100hz(&dc->dml.soc) || (pipe->plane_state && pipe->plane_state->src_rect.width > 5120); - if (remaining_det_segs > MIN_RESERVED_DET_SEGS) + if (remaining_det_segs > MIN_RESERVED_DET_SEGS && crb_pipes != 0) pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs - MIN_RESERVED_DET_SEGS) / crb_pipes + (crb_idx < (remaining_det_segs - MIN_RESERVED_DET_SEGS) % crb_pipes ? 1 : 0); if (pipes[pipe_cnt].pipe.src.det_size_override > 2 * DCN3_15_MAX_DET_SEGS) { -- 2.43.0