Skip to content

Commit 5c6aef8

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 839484a commit 5c6aef8

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
@@ -951,6 +951,15 @@ bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx)
951951
bool res = false;
952952
DC_LOGGER_INIT(pipe_ctx->stream->ctx->logger);
953953

954+
/* Invalid input */
955+
if (!plane_state->dst_rect.width ||
956+
!plane_state->dst_rect.height ||
957+
!plane_state->src_rect.width ||
958+
!plane_state->src_rect.height) {
959+
ASSERT(0);
960+
return false;
961+
}
962+
954963
pipe_ctx->plane_res.scl_data.format = convert_pixel_format_to_dalsurface(
955964
pipe_ctx->plane_state->format);
956965

0 commit comments

Comments
 (0)