diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-09-09 08:47:24 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-09-09 08:47:24 +0000 |
commit | 0b16a77ae8c09995bd35908569d86586c8c7aae4 (patch) | |
tree | 454da1e69d7c05c56564f9594f6f86dd4fb9f520 /sys/dev | |
parent | 6fbca7ae51ea7a06b481496913cf3aaed98adb1c (diff) |
drm/amd/display: Check index for aux_rd_interval before using
From Alex Hung
48e0b68e2360b16edf2a0bae05c0051c00fbb48a in linux-6.6.y/6.6.50
9ba2ea6337b4f159aecb177555a6a81da92d302e in mainline linux
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/drm/amd/display/dc/link/protocols/link_dp_training.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/display/dc/link/protocols/link_dp_training.c b/sys/dev/pci/drm/amd/display/dc/link/protocols/link_dp_training.c index cda3f72232c..d14e6242201 100644 --- a/sys/dev/pci/drm/amd/display/dc/link/protocols/link_dp_training.c +++ b/sys/dev/pci/drm/amd/display/dc/link/protocols/link_dp_training.c @@ -914,10 +914,10 @@ static enum dc_status configure_lttpr_mode_non_transparent( /* Driver does not need to train the first hop. Skip DPCD read and clear * AUX_RD_INTERVAL for DPTX-to-DPIA hop. */ - if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA) + if (link->ep_type == DISPLAY_ENDPOINT_USB4_DPIA && repeater_cnt > 0 && repeater_cnt < MAX_REPEATER_CNT) link->dpcd_caps.lttpr_caps.aux_rd_interval[--repeater_cnt] = 0; - for (repeater_id = repeater_cnt; repeater_id > 0; repeater_id--) { + for (repeater_id = repeater_cnt; repeater_id > 0 && repeater_id < MAX_REPEATER_CNT; repeater_id--) { aux_interval_address = DP_TRAINING_AUX_RD_INTERVAL_PHY_REPEATER1 + ((DP_REPEATER_CONFIGURATION_AND_STATUS_SIZE) * (repeater_id - 1)); core_link_read_dpcd( |