1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/gpu/drm/amd/display/dc/dml2
Srinivasan Shanmugam 34b811a281 drm/amd/display: Prevent potential buffer overflow in map_hw_resources
Adds a check in the map_hw_resources function to prevent a potential
buffer overflow. The function was accessing arrays using an index that
could potentially be greater than the size of the arrays, leading to a
buffer overflow.

Adds a check to ensure that the index is within the bounds of the
arrays. If the index is out of bounds, an error message is printed and
break it will continue execution with just ignoring extra data early to
prevent the buffer overflow.

Reported by smatch:
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c:79 map_hw_resources() error: buffer overflow 'dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_stream_id' 6 <= 7
drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml2_wrapper.c:81 map_hw_resources() error: buffer overflow 'dml2->v20.scratch.dml_to_dc_pipe_mapping.disp_cfg_to_plane_id' 6 <= 7

Fixes: 7966f319c6 ("drm/amd/display: Introduce DML2")
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Qingqing Zhuo <Qingqing.Zhuo@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Suggested-by: Roman Li <roman.li@amd.com>
Reviewed-by: Roman Li <roman.li@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-02-26 11:12:54 -05:00
..
cmntypes.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
display_mode_core.c drm/amd/display: Fix DML2 watermark calculation 2024-01-15 18:35:38 -05:00
display_mode_core.h drm/amd/display: Add z8_marks in dml 2023-10-09 16:50:12 -04:00
display_mode_core_structs.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
display_mode_lib_defines.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
display_mode_util.c drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
display_mode_util.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml2_dc_resource_mgmt.c drm/amd/display: Add NULL-checks in dml2 assigned pipe search 2024-01-22 17:13:27 -05:00
dml2_dc_resource_mgmt.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml2_dc_types.h drm/amd/display: Refactor dc_state interface 2023-12-19 14:59:02 -05:00
dml2_internal_types.h drm/amd/display: Fix handling duplicate planes on one stream 2023-11-07 12:03:30 -05:00
dml2_mall_phantom.c drm/amd/display: Refactor phantom resource allocation 2023-12-19 14:59:02 -05:00
dml2_mall_phantom.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml2_policy.c drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml2_policy.h drm/amd/display: Introduce DML2 2023-10-09 16:48:51 -04:00
dml2_translation_helper.c drm/amd/display: fix input states translation error for dcn35 & dcn351 2024-02-22 10:24:15 -05:00
dml2_translation_helper.h drm/amd/display: Fix handling duplicate planes on one stream 2023-11-07 12:03:30 -05:00
dml2_utils.c drm/amd/display: Simplify the calculation of variables 2024-02-07 12:26:23 -05:00
dml2_utils.h drm/amd/display: always use mpc factor of 2 for stereo timings 2023-11-29 16:48:59 -05:00
dml2_wrapper.c drm/amd/display: Prevent potential buffer overflow in map_hw_resources 2024-02-26 11:12:54 -05:00
dml2_wrapper.h drm/amd/display: Refactor phantom resource allocation 2023-12-19 14:59:02 -05:00
dml_assert.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml_depedencies.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
dml_display_rq_dlg_calc.c drm/amd/display: Introduce DML2 2023-10-09 16:48:51 -04:00
dml_display_rq_dlg_calc.h drm/amd/display: Introduce DML2 2023-10-09 16:48:51 -04:00
dml_logging.h drm/amd/display: Fix copyright notice in DML2 code 2023-10-26 18:41:22 -04:00
Makefile drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml2 2023-11-03 11:59:52 -04:00