coreboot/tests/commonlib/Makefile.mk
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

24 lines
746 B
Makefile

# SPDX-License-Identifier: GPL-2.0-only
subdirs-y += bsd
tests-y += list-test
tests-y += rational-test
tests-y += region-test
tests-y += device_tree-test
device_tree-test-srcs += tests/commonlib/device_tree-test.c
device_tree-test-srcs += tests/stubs/console.c
device_tree-test-srcs += src/commonlib/bsd/string.c
device_tree-test-srcs += src/commonlib/device_tree.c
device_tree-test-srcs += src/commonlib/list.c
device_tree-test-syssrcs += tests/helpers/file.c
list-test-srcs += tests/commonlib/list-test.c
list-test-srcs += src/commonlib/list.c
rational-test-srcs += tests/commonlib/rational-test.c
rational-test-srcs += src/commonlib/rational.c
region-test-srcs += tests/commonlib/region-test.c
region-test-srcs += src/commonlib/region.c