1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/gpu/drm/amd/display
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
..
amdgpu_dm drm/amd/display: fix null-pointer dereference on edid reading 2024-02-22 12:05:26 -05:00
dc drm/amd/display: Prevent potential buffer overflow in map_hw_resources 2024-02-26 11:12:54 -05:00
dmub drm/amd/display: Fix S4 hang polling on HW power up done for VBIOS DMCUB 2024-02-22 10:18:00 -05:00
include drm/amd/display: Update FIXED_VS Retimer HWSS Test Pattern Sequences 2024-02-14 17:13:03 -05:00
modules drm/amd/display: Fix nanosec stat overflow 2024-02-22 10:26:15 -05:00
Kconfig drm/amd/display: Allow building DC with clang on RISC-V 2023-07-21 16:52:25 -04:00
Makefile drm/amd/display: Refactor OPTC into component folder 2023-11-29 16:49:01 -05:00