Skip to content

Commit

Permalink
drm/amd/display: Validate hw_points_num before using it
Browse files Browse the repository at this point in the history
[WHAT]
hw_points_num is 0 before ogam LUT is programmed; however, function
"dwb3_program_ogam_pwl" assumes hw_points_num is always greater than 0,
i.e. substracting it by 1 as an array index.

[HOW]
Check hw_points_num is not equal to 0 before using it.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Alex Hung authored and Alex Deucher committed Oct 3, 2023
1 parent 8a30777 commit 58c3b33
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/display/dc/dcn30/dcn30_dwb_cm.c
Original file line number Diff line number Diff line change
@@ -243,6 +243,9 @@ static bool dwb3_program_ogam_lut(
return false;
}

if (params->hw_points_num == 0)
return false;

REG_SET(DWB_OGAM_CONTROL, 0, DWB_OGAM_MODE, 2);

current_mode = dwb3_get_ogam_current(dwbc30);

0 comments on commit 58c3b33

Please sign in to comment.