From 194ac9422ac956e7b1f0dd43649a169bbbf86c58 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Tue, 9 Dec 2025 15:50:53 -0600 Subject: [PATCH] libfdt: fdt_get_name: Add can_assume(VALID_DTB) check In this function from fdt_ro.c we have (reasonably) some checks of the DTB before we begin work. However, we do this in a way that we cannot make use of the normal FDT_RO_PROBE macro and instead have a direct call to fdt_ro_probe_(). Add a test for !can_assume(VALID_DTB) here first so that in cases where we are assuming a valid DTB we can omit the checks. Signed-off-by: Tom Rini Message-ID: <20251210022002.3004223-4-trini@konsulko.com> Signed-off-by: David Gibson --- libfdt/fdt_ro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index b78c4e4..63494fb 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -306,8 +306,8 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *len) const char *nameptr; int err; - if (((err = fdt_ro_probe_(fdt)) < 0) - || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) + if (!can_assume(VALID_DTB) && (((err = fdt_ro_probe_(fdt)) < 0) + || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0))) goto fail; nameptr = nh->name;