libfdt: fdt_get_name: Add can_assume(VALID_DTB) check
Some checks failed
Build test / build-make (alpine) (push) Has been cancelled
Build test / build-make (archlinux) (push) Has been cancelled
Build test / build-make (fedora) (push) Has been cancelled
Build test / build-make (ubuntu) (push) Has been cancelled
Build test / build-meson (alpine) (push) Has been cancelled
Build test / build-meson (archlinux) (push) Has been cancelled
Build test / build-meson (fedora) (push) Has been cancelled
Build test / build-meson (ubuntu) (push) Has been cancelled
Build test / clang64 (push) Has been cancelled
Build test / mingw32 (push) Has been cancelled
Build test / mingw64 (push) Has been cancelled
Build test / ucrt64 (push) Has been cancelled

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 <trini@konsulko.com>
Message-ID: <20251210022002.3004223-4-trini@konsulko.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Tom Rini 2025-12-09 15:50:53 -06:00 committed by David Gibson
parent 39cae0bd00
commit 194ac9422a

View file

@ -306,8 +306,8 @@ const char *fdt_get_name(const void *fdt, int nodeoffset, int *len)
const char *nameptr; const char *nameptr;
int err; int err;
if (((err = fdt_ro_probe_(fdt)) < 0) if (!can_assume(VALID_DTB) && (((err = fdt_ro_probe_(fdt)) < 0)
|| ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)) || ((err = fdt_check_node_offset_(fdt, nodeoffset)) < 0)))
goto fail; goto fail;
nameptr = nh->name; nameptr = nh->name;