diff options
| author | Anson Jacob <[email protected]> | 2021-03-01 19:25:44 +0000 |
|---|---|---|
| committer | Alex Deucher <[email protected]> | 2021-04-09 20:41:21 +0000 |
| commit | 54718747a6e1037317a8b3610c3be40621b2b75e (patch) | |
| tree | 4373da5a31aa5a5140f1e7c9ddfa582beae2870b /drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h | |
| parent | drm/amd/display: Fixed Clock Recovery Sequence (diff) | |
| download | kernel-54718747a6e1037317a8b3610c3be40621b2b75e.tar.gz kernel-54718747a6e1037317a8b3610c3be40621b2b75e.zip | |
drm/amd/display: Fix UBSAN: shift-out-of-bounds warning
[Why]
On NAVI14 CONFIG_UBSAN reported shift-out-of-bounds at
display_rq_dlg_calc_20v2.c:304:38
rq_param->misc.rq_c.blk256_height is 0 when chroma(*_c) is invalid.
dml_log2 returns -1023 for log2(0), although log2(0) is undefined.
Which ended up as:
rq_param->dlg.rq_c.swath_height = 1 << -1023
[How]
Fix applied on all dml versions.
1. Ensure dml_log2 is only called if the argument is greater than 0.
2. Subtract req128_l/req128_c from log2_swath_height_l/log2_swath_height_c
only when it is greater than 0.
Tested-by: Daniel Wheeler <[email protected]>
Signed-off-by: Anson Jacob <[email protected]>
Reviewed-by: Dmytro Laktyushkin <[email protected]>
Reviewed-by: Jun Lei <[email protected]>
Acked-by: Solomon Chiu <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h')
0 files changed, 0 insertions, 0 deletions
