Subject: Coverity: drm_dp_get_adjust_request_post_cursor(): Memory - corruptions

From: coverity-bot <[email-masked]>
Date: Mon, 28 Oct 2019 16:05:14 -0700

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191025 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by recent commits:

79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")

Coverity reported the following:

*** CID 1487366:  Memory - corruptions  (OVERRUN)
/drivers/gpu/drm/drm_dp_helper.c: 127 in drm_dp_get_adjust_request_post_cursor()
121     EXPORT_SYMBOL(drm_dp_get_adjust_request_pre_emphasis);
122
123     u8 drm_dp_get_adjust_request_post_cursor(const u8 link_status[DP_LINK_STATUS_SIZE],
124     					 unsigned int lane)
125     {
126     	unsigned int offset = DP_ADJUST_REQUEST_POST_CURSOR2;
vvv     CID 1487366:  Memory - corruptions  (OVERRUN)
vvv     Overrunning buffer pointed to by "link_status" of 6 bytes by passing it to a function which accesses it at byte offset 10 using argument "offset" (which evaluates to 524).
127     	u8 value = dp_link_status(link_status, offset);
128
129     	return (value >> (lane << 1)) & 0x3;
130     }
131     EXPORT_SYMBOL(drm_dp_get_adjust_request_post_cursor);
132

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include:

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1487366 ("Memory - corruptions")
Fixes: 79465e0ffeb9 ("drm/dp: Add helper to get post-cursor adjustments")

Thanks for your attention!

-- 
Coverity-bot