Aurabindo Pillai
eaf3adb8fa
drm/amd/display: fix a UBSAN warning in DML2.1
When programming phantom pipe, since cursor_width is explicity set to 0,
this causes calculation logic to trigger overflow for an unsigned int
triggering the kernel's UBSAN check as below:
[ 40.962845] UBSAN: shift-out-of-bounds in /tmp/amd.EfpumTkO/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_core/dml2_core_dcn4_calcs.c:3312:34
[ 40.962849] shift exponent 4294967170 is too large for 32-bit type 'unsigned int'
[ 40.962852] CPU: 1 PID: 1670 Comm: gnome-shell Tainted: G W OE 6.5.0-41-generic #41~22.04.2-Ubuntu
[ 40.962854] Hardware name: Gigabyte Technology Co., Ltd. X670E AORUS PRO X/X670E AORUS PRO X, BIOS F21 01/10/2024
[ 40.962856] Call Trace:
[ 40.962857] <TASK>
[ 40.962860] dump_stack_lvl+0x48/0x70
[ 40.962870] dump_stack+0x10/0x20
[ 40.962872] __ubsan_handle_shift_out_of_bounds+0x1ac/0x360
[ 40.962878] calculate_cursor_req_attributes.cold+0x1b/0x28 [amdgpu]
[ 40.963099] dml_core_mode_support+0x6b91/0x16bc0 [amdgpu]
[ 40.963327] ? srso_alias_return_thunk+0x5/0x7f
[ 40.963331] ? CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport+0x18b8/0x2790 [amdgpu]
[ 40.963534] ? srso_alias_return_thunk+0x5/0x7f
[ 40.963536] ? dml_core_mode_support+0xb3db/0x16bc0 [amdgpu]
[ 40.963730] dml2_core_calcs_mode_support_ex+0x2c/0x90 [amdgpu]
[ 40.963906] ? srso_alias_return_thunk+0x5/0x7f
[ 40.963909] ? dml2_core_calcs_mode_support_ex+0x2c/0x90 [amdgpu]
[ 40.964078] core_dcn4_mode_support+0x72/0xbf0 [amdgpu]
[ 40.964247] dml2_top_optimization_perform_optimization_phase+0x1d3/0x2a0 [amdgpu]
[ 40.964420] dml2_build_mode_programming+0x23d/0x750 [amdgpu]
[ 40.964587] dml21_validate+0x274/0x770 [amdgpu]
[ 40.964761] ? srso_alias_return_thunk+0x5/0x7f
[ 40.964763] ? resource_append_dpp_pipes_for_plane_composition+0x27c/0x3b0 [amdgpu]
[ 40.964942] dml2_validate+0x504/0x750 [amdgpu]
[ 40.965117] ? dml21_copy+0x95/0xb0 [amdgpu]
[ 40.965291] ? srso_alias_return_thunk+0x5/0x7f
[ 40.965295] dcn401_validate_bandwidth+0x4e/0x70 [amdgpu]
[ 40.965491] update_planes_and_stream_state+0x38d/0x5c0 [amdgpu]
[ 40.965672] update_planes_and_stream_v3+0x52/0x1e0 [amdgpu]
[ 40.965845] ? srso_alias_return_thunk+0x5/0x7f
[ 40.965849] dc_update_planes_and_stream+0x71/0xb0 [amdgpu]
Fix this by adding a guard for checking cursor width before triggering
the size calculation.
Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Wayne Lin <wayne.lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2024-08-06 11:11:01 -04:00
..
2024-06-28 09:41:04 +10:00
2024-05-24 08:43:25 -07:00
2024-06-21 12:55:12 +02:00
2024-04-18 12:09:14 +01:00
2024-05-04 18:59:47 +02:00
2024-06-30 22:23:39 +02:00
2024-05-06 18:26:47 -07:00
2024-05-22 10:45:12 -07:00
2024-07-05 10:47:28 +02:00
2024-06-14 06:21:25 -06:00
2024-05-23 12:04:36 -07:00
2024-05-22 20:14:47 -04:00
2024-04-11 07:28:37 +01:00
2024-05-15 12:59:55 -06:00
2024-04-13 12:41:01 +02:00
2024-06-24 16:20:58 +10:00
2024-06-12 16:58:05 -07:00
2024-05-22 09:56:00 -07:00
2024-04-23 13:16:03 +02:00
2024-06-22 13:48:11 +09:00
2024-06-24 20:55:11 +02:00
2024-05-16 08:50:32 -07:00
2024-06-27 17:43:15 -07:00
2024-05-28 16:09:17 -07:00
2024-05-19 09:21:03 -07:00
2024-05-09 00:30:37 +09:00
2024-06-11 23:39:26 +05:30
2024-06-21 11:06:56 +10:00
2024-05-13 16:53:53 -07:00
2024-06-04 11:29:52 +02:00
2024-05-03 22:09:50 +02:00
2024-05-09 01:03:39 +09:00
2024-06-15 14:59:26 +09:00
2024-07-05 12:45:41 +02:00
2024-05-22 12:26:46 -07:00
2024-06-27 17:21:28 +02:00
2024-08-06 11:11:01 -04:00
2024-05-04 18:59:41 +02:00
2024-06-08 10:48:11 -07:00
2024-04-16 11:31:09 +02:00
2024-04-12 11:02:58 -07:00
2024-06-06 06:03:29 +00:00
2024-05-30 09:05:19 -07:00
2024-05-22 12:26:46 -07:00
2024-06-28 20:44:38 +02:00
2024-05-23 00:29:19 +02:00
2024-06-09 12:02:34 +01:00
2024-06-21 10:19:36 -03:00
2024-06-24 14:36:11 -04:00
2024-05-22 20:14:47 -04:00
2024-06-27 12:14:19 +02:00
2024-06-23 17:09:26 +02:00
2024-04-11 14:23:47 -07:00
2024-06-16 09:33:28 -07:00
2024-05-17 09:05:46 -07:00
2024-05-31 12:39:15 -05:00
2024-04-29 10:53:31 +02:00
2024-05-28 06:55:59 -06:00
2024-06-12 09:28:04 -07:00
2024-05-17 08:53:47 -07:00
2024-04-25 11:58:52 +02:00
2024-05-14 18:25:53 -07:00
2024-06-14 08:43:39 +01:00
2024-07-05 10:47:28 +02:00
2024-06-20 16:42:30 +02:00
2024-05-21 09:51:42 -07:00
2024-04-29 08:20:07 -07:00
2024-06-27 12:35:58 +02:00
2024-05-29 13:08:31 +01:00
2024-04-25 12:53:30 -05:00
2024-05-23 12:04:36 -07:00
2024-06-26 10:13:04 -07:00
2024-05-03 07:26:39 +02:00
2024-05-30 19:43:47 -05:00
2024-05-17 13:01:24 +02:00
2024-04-25 20:55:53 -07:00
2024-06-04 18:08:31 +02:00
2024-06-24 23:33:38 +02:00
2024-04-16 00:14:43 +02:00
2024-05-23 12:09:22 -07:00
2024-06-03 19:30:47 +05:30
2024-06-17 10:36:56 +02:00
2024-07-05 10:47:28 +02:00
2024-05-27 08:18:31 -07:00
2024-05-28 21:53:51 +02:00
2024-05-20 08:55:18 -07:00
2024-04-30 21:10:37 +02:00
2024-04-29 08:20:06 -07:00
2024-06-18 13:26:44 -07:00
2024-06-22 16:13:19 +02:00
2024-05-14 23:36:19 +09:00
2024-06-16 11:22:57 +02:00
2024-06-12 21:30:43 +01:00
2024-05-06 13:34:12 -06:00
2024-05-18 12:48:37 -07:00
2024-05-23 12:04:36 -07:00
2024-05-07 23:40:46 +02:00
2024-06-24 11:07:06 +02:00
2024-06-30 14:32:24 -07:00
2024-05-08 19:21:51 +01:00
2024-07-05 12:45:41 +02:00
2024-06-03 17:35:24 +05:30
2024-06-19 14:07:13 +01:00
2024-05-08 19:46:11 +01:00
2024-06-27 15:47:30 +02:00
2024-05-21 13:11:44 -07:00
2024-04-29 22:29:44 +02:00
2024-06-25 14:37:05 +02:00
2024-05-31 13:13:39 +03:00
2024-06-30 08:57:43 -07:00
2024-06-13 21:00:25 -04:00
2024-04-23 13:16:03 +02:00
2024-06-30 08:54:24 -07:00
2024-05-22 08:32:48 -04:00
2024-06-12 15:40:39 -06:00
2024-05-23 12:04:36 -07:00
2024-06-24 13:24:02 +02:00
2024-05-19 09:21:03 -07:00
2024-05-23 12:04:36 -07:00
2024-06-15 12:49:57 +02:00
2024-05-24 10:24:49 -07:00
2024-04-29 16:45:53 +02:00
2024-05-10 04:34:52 +09:00