Commit 7eb90975 authored by Joshua Aberback's avatar Joshua Aberback Committed by Alex Deucher

drm/amd/display: Fix for NULL ramp pointer crashing driver

[Why]
In certain scenarios the ramp parameter come in as NULL, which crashes
because this function doesn't guard properly in the early return.

[How]
- parameter mapUserRamp should be the guard (false means no ramp)
- remove checking ramp in early return
Signed-off-by: default avatarJoshua Aberback <joshua.aberback@amd.com>
Reviewed-by: default avatarSivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
Acked-by: default avatarEryk Brol <Eryk.Brol@amd.com>
Acked-by: default avatarLeo Li <sunpeng.li@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ffb6c1c6
...@@ -1772,8 +1772,7 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, ...@@ -1772,8 +1772,7 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf,
/* we can use hardcoded curve for plain SRGB TF */ /* we can use hardcoded curve for plain SRGB TF */
if (input_tf->type == TF_TYPE_PREDEFINED && if (input_tf->type == TF_TYPE_PREDEFINED &&
input_tf->tf == TRANSFER_FUNCTION_SRGB && input_tf->tf == TRANSFER_FUNCTION_SRGB &&
(!mapUserRamp && !mapUserRamp)
(ramp->type == GAMMA_RGB_256 || ramp->num_entries == 0)))
return true; return true;
input_tf->type = TF_TYPE_DISTRIBUTED_POINTS; input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment