1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/gpu/drm/amd/display/dc/link/protocols
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
..
link_ddc.c drm/amd/display: switch DC over to the new DRM logging macros 2023-09-26 17:00:21 -04:00
link_ddc.h drm/amd/display: Support Compliance Test Pattern Generation with DP2 Retimer 2023-08-15 18:08:27 -04:00
link_dp_capability.c drm/amd/display: Wake DMCUB before sending a command 2023-12-19 14:59:02 -05:00
link_dp_capability.h drm/amd/display: convert link.h functions to function pointer style 2023-03-14 15:35:03 -04:00
link_dp_dpia.c drm/amd/display: Dpia hpd status not in sync after S4 2024-01-09 15:43:54 -05:00
link_dp_dpia.h drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_dp_dpia_bw.c drm/amd/display: Fix buffer overflow in 'get_host_router_total_dp_tunnel_bw()' 2024-01-31 14:05:19 -05:00
link_dp_dpia_bw.h drm/amd/display: Request usb4 bw for mst streams 2024-01-09 15:43:54 -05:00
link_dp_irq_handler.c drm/amd/display: Fix Replay Desync Error IRQ handler 2023-12-06 15:22:34 -05:00
link_dp_irq_handler.h drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_dp_phy.c drm/amd/display: Refactor edp power control 2023-08-30 14:58:42 -04:00
link_dp_phy.h drm/amd/display: convert link.h functions to function pointer style 2023-03-14 15:35:03 -04:00
link_dp_training.c drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings() 2024-01-05 16:10:44 -05:00
link_dp_training.h drm/amd/display: avoid stringop-overflow warnings for dp_decide_lane_settings() 2024-01-05 16:10:44 -05:00
link_dp_training_8b_10b.c drm/amd/display: Add logging when DP link training Channel EQ is Successful 2023-06-09 09:27:14 -04:00
link_dp_training_8b_10b.h
link_dp_training_128b_132b.c drm/amd/display: Add logging when DP link training Channel EQ is Successful 2023-06-09 09:27:14 -04:00
link_dp_training_128b_132b.h
link_dp_training_auxless.c drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_dp_training_auxless.h drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_dp_training_dpia.c drm/amd/display: Skip DPIA-specific DP LL automation flag for non-DPIA links 2023-12-06 15:22:33 -05:00
link_dp_training_dpia.h drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_dp_training_fixed_vs_pe_retimer.c drm/amd/display: Update Fixed VS/PE Retimer Sequence 2023-11-29 16:49:23 -05:00
link_dp_training_fixed_vs_pe_retimer.h drm/amd/display: Improve robustness of FIXED_VS link training at DP1 rates 2023-04-11 18:03:43 -04:00
link_dpcd.c drm/amd/display: Fix uninitialized variable usage in core_link_ 'read_dpcd() & write_dpcd()' functions 2024-01-22 17:13:26 -05:00
link_dpcd.h
link_edp_panel_control.c drm/amd/display: Fix variable deferencing before NULL check in edp_setup_replay() 2024-01-15 18:32:19 -05:00
link_edp_panel_control.h drm/amd/display: Add some functions for Panel Replay 2024-01-03 11:16:05 -05:00
link_hpd.c drm/amd/display: move dc_link functions in protocols folder to dc_link_exports 2023-03-07 14:22:40 -05:00
link_hpd.h drm/amd/display: convert link.h functions to function pointer style 2023-03-14 15:35:03 -04:00