]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:35 +0000 (12:00 +0200)
commit26ced9d86240868f5b41708ceee02e6ec2924498
treea58f3ce0de84ce1efb7f1e964ab2fc9923c32abe
parent677f6e91c66751b52c5596c9e943c2dca5b7b20c
drm/amd/display: Avoid overflow assignment in link_dp_cts

[ Upstream commit a15268787b79fd183dd526cc16bec9af4f4e49a1 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
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