]> git.baikalelectronics.ru Git - kernel.git/commit
drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes
authorAlex Hung <alex.hung@amd.com>
Wed, 11 Jan 2023 16:54:11 +0000 (09:54 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:33:55 +0000 (13:33 +0100)
commit717196d0326156a41ad8186f204dd378448069ae
tree3b416ef76baff5c73e3ddcbe7aa064e23d4e83f3
parent456227b5a5182d50f9018f0c163cd957ba12f0f5
drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes

[ Upstream commit f4750051e0ef189844a5c9d79be4deba56cf9a74 ]

[WHY]
When PTEBufferSizeInRequests is zero, UBSAN reports the following
warning because dml_log2 returns an unexpected negative value:

  shift exponent 4294966273 is too large for 32-bit type 'int'

[HOW]

In the case PTEBufferSizeInRequests is zero, skip the dml_log2() and
assign the result directly.

Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@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/dml/dcn30/display_mode_vba_30.c