coreboot/tests
Yu-Ping Wu 1e1b63c23b commonlib/device_tree: Utilize list_move() in dt_copy_subtree()
In dt_copy_subtree(), the device_tree_node copying

 *dst_node = *src_node;

doesn't work correctly for circular linked lists [1], because the 'next'
pointer of the last element isn't modified to point to the dst head.

As the only public caller of dt_copy_subtree() is dt_apply_overlay(),
and the dt_apply_overlay() function comment already explicitly disallows
'overlay' accesses after the call, fix the problem by utilizing
list_move() for copying device tree node properties and children.

Also add a new test case test_dt_apply_overlay.

[1] commit 23c41622a9 ("commonlib/list: Change to circular list")

BUG=b:434080284
TEST=emerge-rauru coreboot libpayload
BRANCH=none

Change-Id: I166ab74c9de67330d52f94e92b5d7ce5ddefa82b
Signed-off-by: Yu-Ping Wu <yupingso@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/91558
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Subrata Banik <subratabanik@google.com>
Reviewed-by: Jakub "Kuba" Czapiga <czapiga@google.com>
2026-03-07 01:19:35 +00:00
..
acpi tests: Rename Makefiles from .inc to .mk 2024-01-26 12:43:08 +00:00
commonlib commonlib/device_tree: Utilize list_move() in dt_copy_subtree() 2026-03-07 01:19:35 +00:00
console tests: Rename Makefiles from .inc to .mk 2024-01-26 12:43:08 +00:00
data/lib tests/imd: Fix invalid NULL comparison on uintptr_t 2025-09-30 11:55:53 +00:00
device tests: Replace 'unsigned long int' by 'unsigned long' 2025-01-12 04:52:30 +00:00
drivers tests/drivers/efivars: Remove duplicated <limits.h> 2024-07-03 20:21:06 +00:00
helpers tests/lib: Factor out file related functions 2024-05-21 13:44:39 +00:00
include include/fmap.h: Require FMAP_FLASH_SIZE == CONFIG_ROM_SIZE 2026-01-23 18:54:11 +00:00
lib tests/lib/coreboot_table-test.c: Add lb_string_platform_blob_version 2026-01-23 21:38:33 +00:00
mock tests: Fix tests code and comments style 2022-01-14 14:29:29 +00:00
stubs tree: Use <stdio.h> for snprintf 2024-05-29 10:33:54 +00:00
Makefile.common include/fmap.h: Require FMAP_FLASH_SIZE == CONFIG_ROM_SIZE 2026-01-23 18:54:11 +00:00
Makefile.mk tests: Disable generation of lcov HTML 2025-12-22 14:35:20 +00:00