public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.1.y] drm/amd/display: Check denominator crb_pipes before used
@ 2025-03-31 12:37 Cliff Liu
  2025-03-31 14:48 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Cliff Liu @ 2025-03-31 12:37 UTC (permalink / raw)
  To: stable
  Cc: harry.wentland, sunpeng.li, Rodrigo.Siqueira, alexander.deucher,
	christian.koenig, Xinhui.Pan, airlied, daniel, alex.hung, jetlan9,
	wayne.lin, donghua.liu, hersenxs.wu, amd-gfx, dri-devel,
	linux-kernel, Zhe.He

From: Alex Hung <alex.hung@amd.com>

[ 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 <harry.wentland@amd.com>
Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Cliff Liu <donghua.liu@windriver.com>
Signed-off-by: He Zhe <Zhe.He@windriver.com>
---
Verified the build test.
---
 drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c b/drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c
index e78954514e3e..958170fbfece 100644
--- a/drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c
@@ -1772,7 +1772,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.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6.1.y] drm/amd/display: Check denominator crb_pipes before used
  2025-03-31 12:37 [PATCH 6.1.y] drm/amd/display: Check denominator crb_pipes before used Cliff Liu
@ 2025-03-31 14:48 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2025-03-31 14:48 UTC (permalink / raw)
  To: stable; +Cc: Cliff Liu, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: ea79068d4073bf303f8203f2625af7d9185a1bc6

WARNING: Author mismatch between patch and upstream commit:
Backport author: Cliff Liu<donghua.liu@windriver.com>
Commit author: Alex Hung<alex.hung@amd.com>

Status in newer kernel trees:
6.13.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Not found

Note: The patch differs from the upstream commit:
---
1:  ea79068d4073b ! 1:  958f070b24e78 drm/amd/display: Check denominator crb_pipes before used
    @@ Metadata
      ## Commit message ##
         drm/amd/display: Check denominator crb_pipes before used
     
    +    [ Upstream commit ea79068d4073bf303f8203f2625af7d9185a1bc6 ]
    +
         [WHAT & HOW]
         A denominator cannot be 0, and is checked before used.
     
    @@ Commit message
         Signed-off-by: Alex Hung <alex.hung@amd.com>
         Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
         Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    +    Signed-off-by: Cliff Liu <donghua.liu@windriver.com>
    +    Signed-off-by: He Zhe <Zhe.He@windriver.com>
     
    - ## drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c ##
    -@@ drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c: static int dcn315_populate_dml_pipes_from_context(
    + ## drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c ##
    +@@ drivers/gpu/drm/amd/display/dc/dcn315/dcn315_resource.c: 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);
      
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-31 14:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 12:37 [PATCH 6.1.y] drm/amd/display: Check denominator crb_pipes before used Cliff Liu
2025-03-31 14:48 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox