linux/drivers/gpu/drm/amd/display/dc
Srinivasan Shanmugam e3854253a5 drm/amd/display: Fix buffer overflow in 'get_host_router_total_dp_tunnel_bw()'
The error message buffer overflow 'dc->links' 12 <= 12 suggests that the
code is trying to access an element of the dc->links array that is
beyond its bounds. In C, arrays are zero-indexed, so an array with 12
elements has valid indices from 0 to 11. Trying to access dc->links[12]
would be an attempt to access the 13th element of a 12-element array,
which is a buffer overflow.

To fix this, ensure that the loop does not go beyond the last valid
index when accessing dc->links[i + 1] by subtracting 1 from the loop
condition.

This would ensure that i + 1 is always a valid index in the array.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/dc/link/protocols/link_dp_dpia_bw.c:208 get_host_router_total_dp_tunnel_bw() error: buffer overflow 'dc->links' 12 <= 12

Fixes: 59f1622a5f ("drm/amd/display: Add dpia display mode validation logic")
Cc: PeiChen Huang <peichen.huang@amd.com>
Cc: Aric Cyr <aric.cyr@amd.com>
Cc: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-01-31 14:05:19 -05:00
..
basics drm/amd/display: Add dpp_get_gamut_remap functions 2024-01-22 17:13:26 -05:00
bios drm/amdgpu: check PS, WS index 2024-01-15 18:35:37 -05:00
clk_mgr drm/amd/display: clkmgr unittest with removal of warn & rename DCN35 ips handshake for idle 2024-01-29 15:46:13 -05:00
core drm/amd/display: For FPO and SubVP/DRR configs program vmin/max sel 2024-01-29 15:42:02 -05:00
dce drm/amd/display: fix DP audio settings 2024-01-29 15:46:07 -05:00
dce60 drm/amd/display: Refactor HWSS into component folder 2023-10-09 17:00:09 -04:00
dce80 drm/amd/display: Refactor resource into component directory 2023-11-17 09:30:50 -05:00
dce110 drm/amd/display: Refactor resource into component directory 2023-11-17 09:30:50 -05:00
dce112 drm/amd/display: Refactor resource into component directory 2023-11-17 09:30:50 -05:00
dce120 drm/amd/display: Refactor resource into component directory 2023-11-17 09:30:50 -05:00
dcn10 drm/amd/display: Add dpp_get_gamut_remap functions 2024-01-22 17:13:26 -05:00
dcn20 drm/amd/display: hook up DCN20 color blocks data to DTN log 2024-01-22 17:13:28 -05:00
dcn21 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn30 drm/amd/display: create DCN3-specific log for MPC state 2024-01-22 17:13:27 -05:00
dcn31 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn32 drm/amd/display: fix USB-C flag update after enc10 feature init 2024-01-29 15:42:19 -05:00
dcn35 drm/amd/display: fix USB-C flag update after enc10 feature init 2024-01-29 15:42:19 -05:00
dcn201 drm/amd/display: Add dpp_get_gamut_remap functions 2024-01-22 17:13:26 -05:00
dcn301 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn302 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn303 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn314 drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
dcn321 drm/amd/display: Refactor resource into component directory 2023-11-17 09:30:50 -05:00
dml drm/amd/display: Underflow workaround by increasing SR exit latency 2024-01-29 15:46:00 -05:00
dml2 drm/amd/display: Fix dcn35 8k30 Underflow/Corruption Issue 2024-01-29 15:46:20 -05:00
dsc drm/amd/display: Fix timing bandwidth calculation for HDMI 2024-01-22 17:13:26 -05:00
gpio drm/amd/display: Add DCN35 GPIO 2023-08-30 15:51:14 -04:00
hdcp drm/amd/display: Fix copyright notice in DC code 2023-10-26 18:41:23 -04:00
hwss drm/amd/display: Fix DPSTREAM CLK on and off sequence 2024-01-29 15:45:32 -05:00
inc drm/amd/display: Fix dcn35 8k30 Underflow/Corruption Issue 2024-01-29 15:46:20 -05:00
irq drm/amd/display: Fix copyright notice in DC code 2023-10-26 18:41:23 -04:00
link drm/amd/display: Fix buffer overflow in 'get_host_router_total_dp_tunnel_bw()' 2024-01-31 14:05:19 -05:00
optc drm/amd/display: Clear OPTC mem select on disable 2024-01-15 18:35:38 -05:00
resource drm/amd/display: For FPO and SubVP/DRR configs program vmin/max sel 2024-01-29 15:42:02 -05:00
virtual drm/amd/display: make virtual_disable_link_output static 2022-10-11 11:32:59 -04:00
dc_bios_types.h drm/amd/display: Pass pwrseq inst for backlight and ABM 2023-12-06 15:22:33 -05:00
dc_ddc_types.h drm/amd/display: move public dc link function implementation to dc_link_exports 2023-02-14 16:06:28 -05:00
dc_dmub_srv.c drm/amd/display: Populate invalid split index to be 0xF 2024-01-29 15:46:34 -05:00
dc_dmub_srv.h drm/amd/display: Wake DMCUB before executing GPINT commands 2023-12-19 14:59:02 -05:00
dc_dp_types.h drm/amd/display: Add dpia display mode validation logic 2024-01-03 10:47:12 -05:00
dc_dsc.h drm/amd/display: Add link encoding to timing BW calculation parameters 2023-07-18 11:15:51 -04:00
dc_edid_parser.c
dc_edid_parser.h
dc_hdmi_types.h drm/amd/display/dc/dc_hdmi_types: Move string definition to the only file it's used in 2023-03-22 00:47:59 -04:00
dc_helper.c drm/amd/display: Wake DMCUB before sending a command 2023-12-19 14:59:02 -05:00
dc_hw_types.h drm/amd/display: Fix timing bandwidth calculation for HDMI 2024-01-22 17:13:26 -05:00
dc_plane_priv.h drm/amd/display: Refactor dc_state interface 2023-12-19 14:59:02 -05:00
dc_plane.h drm/amd/display: Refactor dc_state interface 2023-12-19 14:59:02 -05:00
dc_stat.h
dc_state_priv.h drm/amd/display: Refactor phantom resource allocation 2023-12-19 14:59:02 -05:00
dc_state.h drm/amd/display: Refactor phantom resource allocation 2023-12-19 14:59:02 -05:00
dc_stream_priv.h drm/amd/display: Refactor phantom resource allocation 2023-12-19 14:59:02 -05:00
dc_stream.h drm/amd/display: Unify optimize_required flags and VRR adjustments 2024-01-29 15:41:55 -05:00
dc_trace.h drm/amd/display: Add events log to trace OPTC lock and unlock 2022-10-24 14:36:06 -04:00
dc_types.h drm/amd/display: Replay + IPS + ABM in Full Screen VPB 2024-01-22 17:13:27 -05:00
dc.h drm/amd/display: 3.2.270 2024-01-29 15:46:48 -05:00
dm_cp_psp.h drm/amd/display: unhard code link to phy idx mapping in dc link and clean up 2022-01-07 17:21:20 -05:00
dm_event_log.h
dm_helpers.h drm/amd/display: adjust flow for deallocation mst payload 2023-11-29 16:49:00 -05:00
dm_pp_smu.h drm/amd/pm: support return vpe clock table 2023-12-14 15:25:59 -05:00
dm_services_types.h drm/amd/display: refactor dmub commands into single function 2023-04-18 16:28:52 -04:00
dm_services.h drm/amd/display: Show the DCN/DCE version in the log 2023-06-09 09:34:09 -04:00
irq_types.h drm/amd/display: Correct enum typo 2023-10-26 18:59:56 -04:00
Makefile drm/amd/display: Refactor INIT into component folder 2024-01-03 10:47:29 -05:00
os_types.h drm/amd/display: switch DC over to the new DRM logging macros 2023-09-26 17:00:21 -04:00