On Fri, Dec 03, 2021 at 01:25:17AM -0800, Kees Cook wrote:
The link_status array was not large enough to read the Adjust Request Post Cursor2 register. Adjust the size to include it. Found with a -Warray-bounds build:
drivers/gpu/drm/drm_dp_helper.c: In function 'drm_dp_get_adjust_request_post_cursor': drivers/gpu/drm/drm_dp_helper.c:59:27: error: array subscript 10 is outside array bounds of 'const u8[6]' {aka 'const unsigned char[6]'} [-Werror=array-bounds] 59 | return link_status[r - DP_LANE0_1_STATUS]; | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/drm_dp_helper.c:147:51: note: while referencing 'link_status' 147 | u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE], | ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments") Signed-off-by: Kees Cook keescook@chromium.org
v2: Fix missed array size change in intel_dp_check_mst_status()
drivers/gpu/drm/i915/display/intel_dp.c | 8 ++++---- include/drm/drm_dp_helper.h | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-)
This sounds very familiar and I vaguely recall typing up a patch like that a long time ago. But I obviously failed because that never seems to have made it upstream.
Or perhaps I'm misremembering and was thinking about this instead:
https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3...
Bonus points for adding that comment with background information on why we need this.
Reviewed-by: Thierry Reding treding@nvidia.com