]> www.infradead.org Git - users/dwmw2/linux.git/commit
drm/amd/display: Fix Coverity INTEGER_OVERFLOW within decide_fallback_link_setting_ma...
authorHersen Wu <hersenxs.wu@amd.com>
Fri, 26 Apr 2024 16:13:59 +0000 (12:13 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 2 May 2024 20:18:18 +0000 (16:18 -0400)
commit83c0c8361347cf43937348e8ca0a487679c003ae
tree01f040a0f125f2ceb358a36c070947c40ab69dd3
parent55ec7679e6a5f67d2831b87a24fe2d5066311fdd
drm/amd/display: Fix Coverity INTEGER_OVERFLOW within decide_fallback_link_setting_max_bw_policy

[Why]
For addtion (uint8_t) variable + constant 1,
coverity generates message below:
Truncation due to cast operation on "cur_idx + 1" from
32 to 8 bits.

Then Coverity assume result is 32 bits value be saved into
8 bits variable. When result is used as index to access
array, Coverity suspects index invalid.

[How]
Change varaible type to uint32_t.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c