From: Vitaly Prosyak Date: Thu, 12 Jul 2018 19:26:47 +0000 (-0500) Subject: drm/amd/display: Add check for num of entries in gamma X-Git-Tag: v5.15~7648^2~27^2~369 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fdf7a4b1f96520467a578bdd9c90793cf7e8728;p=platform%2Fkernel%2Flinux-starfive.git drm/amd/display: Add check for num of entries in gamma This check avoids potential bugs related to gamma. Signed-off-by: Vitaly Prosyak Reviewed-by: Charlene Liu Acked-by: Bhawanpreet Lakha Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c index 3d1b89a..15427f4 100644 --- a/drivers/gpu/drm/amd/display/modules/color/color_gamma.c +++ b/drivers/gpu/drm/amd/display/modules/color/color_gamma.c @@ -1580,7 +1580,8 @@ bool mod_color_calculate_degamma_params(struct dc_transfer_func *input_tf, /* we can use hardcoded curve for plain SRGB TF */ if (input_tf->type == TF_TYPE_PREDEFINED && input_tf->tf == TRANSFER_FUNCTION_SRGB && - (!mapUserRamp && ramp->type == GAMMA_RGB_256)) + (!mapUserRamp && + (ramp->type == GAMMA_RGB_256 || ramp->num_entries == 0))) return true; input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;