drm/amd/display: fix shift-out-of-bounds in CalculateVMAndRowBytes
stable inclusion from stable-v5.10.176 commit 7257070be70e19a9138f39009c1a26c83a8a7cfa category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8CHVQ Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7257070be70e19a9138f39009c1a26c83a8a7cfa -------------------------------- [ Upstream commit 031f196d ] [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> Signed-off-by:
sanglipeng <sanglipeng1@jd.com>
Loading
Please sign in to comment