]> www.infradead.org Git - users/hch/configfs.git/commit
drm/amd/display: Avoid overflow assignment in link_dp_cts
authorAlex Hung <alex.hung@amd.com>
Wed, 17 Jul 2024 15:17:56 +0000 (09:17 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 27 Jul 2024 21:34:20 +0000 (17:34 -0400)
commita15268787b79fd183dd526cc16bec9af4f4e49a1
tree08adfa5eb6b14174a391315b0502c0ae2914899d
parentcead9ac8b0992ae2659b637e86a0da7cfeb5e267
drm/amd/display: Avoid overflow assignment in link_dp_cts

sampling_rate is an uint8_t but is assigned an unsigned int, and thus it
can overflow. As a result, sampling_rate is changed to uint32_t.

Similarly, LINK_QUAL_PATTERN_SET has a size of 2 bits, and it should
only be assigned to a value less or equal than 4.

This fixes 2 INTEGER_OVERFLOW issues reported by Coverity.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dc_dp_types.h
drivers/gpu/drm/amd/display/dc/link/accessories/link_dp_cts.c
drivers/gpu/drm/amd/display/include/dpcd_defs.h