Skip to content

Commit 175b2dd

Browse files
Michael StraussSasha Levin
authored andcommitted
drm/amd/display: Check for invalid input params when building scaling params
[ Upstream commit 73b1da6 ] [WHY] Function to calculate scaling ratios can be called with invalid plane src/dest, causing a divide by zero. [HOW] Fail building scaling params if plane state src/dest rects are unpopulated Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Reviewed-by: Charlene Liu <Charlene.Liu@amd.com> Acked-by: Tom Chung <chiahsuan.chung@amd.com> Signed-off-by: Michael Strauss <michael.strauss@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Stable-dep-of: 374c9fa ("drm/amd/display: Fix null check for pipe_ctx->plane_state in resource_build_scaling_params") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 96db771 commit 175b2dd

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/dc/core/dc_resource.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,15 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
10251025
bool res = false;
10261026
DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
10271027

1028+
/* Invalid input */
1029+
if (!plane_state->dst_rect.width ||
1030+
!plane_state->dst_rect.height ||
1031+
!plane_state->src_rect.width ||
1032+
!plane_state->src_rect.height) {
1033+
ASSERT(0);
1034+
return false;
1035+
}
1036+
10281037
pipe_ctx->plane_res.scl_data.format = convert_pixel_format_to_dalsurface(
10291038
pipe_ctx->plane_state->format);
10301039

0 commit comments

Comments
 (0)