OSDN Git Service

drm/amd/display: Fix for NULL ramp pointer crashing driver
authorJoshua Aberback <joshua.aberback@amd.com>
Thu, 13 Dec 2018 00:53:02 +0000 (19:53 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Jan 2019 20:40:00 +0000 (15:40 -0500)
[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: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Sivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
Acked-by: Eryk Brol <Eryk.Brol@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/modules/color/color_gamma.c

index beb7bda..4cee084 100644 (file)
@@ -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 */
        if (input_tf->type == TF_TYPE_PREDEFINED &&
                        input_tf->tf == TRANSFER_FUNCTION_SRGB &&
-                       (!mapUserRamp &&
-                       (ramp->type == GAMMA_RGB_256 || ramp->num_entries == 0)))
+                       !mapUserRamp)
                return true;
 
        input_tf->type = TF_TYPE_DISTRIBUTED_POINTS;