drm/amd/display: Fix access of wrong array element TF format conversion
authorHarry Wentland <[email protected]>
Fri, 10 Nov 2017 17:12:40 +0000 (12:12 -0500)
committerAlex Deucher <[email protected]>
Thu, 14 Dec 2017 15:53:11 +0000 (10:53 -0500)
Found by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:357
convert_to_custom_float() error: buffer overflow 'arr_points' 2 <= 2
drivers/gpu/drm/amd/amdgpu/../display/dc/dce110/dce110_hw_sequencer.c:358
convert_to_custom_float() warn: buffer overflow 'arr_points' 2 <= 2

Regression:
drm/amd/display: Remove extra arr_points element

Signed-off-by: Harry Wentland <[email protected]>
Reviewed-by: Tony Cheng <[email protected]>
Acked-by: Harry Wentland <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c

index 981bcd291602a5aca8bed8968d572c359763d5ae..21fc27aab9097fc604a40ee8c6581849d11acbb2 100644 (file)
@@ -354,8 +354,8 @@ static bool convert_to_custom_float(struct pwl_result_data *rgb_resulted,
                return false;
        }
 
-       if (!convert_to_custom_float_format(arr_points[2].slope, &fmt,
-                                           &arr_points[2].custom_float_slope)) {
+       if (!convert_to_custom_float_format(arr_points[1].slope, &fmt,
+                                           &arr_points[1].custom_float_slope)) {
                BREAK_TO_DEBUGGER();
                return false;
        }