Skip to content

Commit f1fd8a0

Browse files
Hersen Wualexdeucher
authored andcommitted
drm/amd/display: Fix overlapping copy within dml_core_mode_programming
[WHY] &mode_lib->mp.Watermark and &locals->Watermark are the same address. memcpy may lead to unexpected behavior. [HOW] memmove should be used. Reviewed-by: Rodrigo Siqueira <[email protected]> Acked-by: Wayne Lin <[email protected]> Reviewed-by: Alex Hung <[email protected]> Signed-off-by: Hersen Wu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1357b21 commit f1fd8a0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/amd/display/dc/dml2/display_mode_core.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9460,8 +9460,10 @@ void dml_core_mode_programming(struct display_mode_lib_st *mode_lib, const struc
94609460

94619461
/* Copy the calculated watermarks to mp.Watermark as the getter functions are
94629462
* implemented by the DML team to copy the calculated values from the mp.Watermark interface.
9463+
* &mode_lib->mp.Watermark and &locals->Watermark are the same address, memcpy may lead to
9464+
* unexpected behavior. memmove should be used.
94639465
*/
9464-
memcpy(&mode_lib->mp.Watermark, CalculateWatermarks_params->Watermark, sizeof(struct Watermarks));
9466+
memmove(&mode_lib->mp.Watermark, CalculateWatermarks_params->Watermark, sizeof(struct Watermarks));
94659467

94669468
for (k = 0; k < mode_lib->ms.num_active_planes; ++k) {
94679469
if (mode_lib->ms.cache_display_cfg.writeback.WritebackEnable[k] == true) {

0 commit comments

Comments
 (0)