xen/dt-overlay: support phandle-based targeting in overlay_get_nodes_info

overlay_get_nodes_info() is called before fdt_overlay_apply() to extract
target paths from the overlay. This fails for overlays using phandle-based
targeting (target = <&label>) because DTC compiles these as unresolved
fixups (target = <0xffffffff>), causing fdt_overlay_target_offset() to
return -FDT_ERR_BADPHANDLE. Prior to this change users were forced to
manually modify the dtbo (even for hwdom) to switch from target to
target-phandle by manually inspecting also the host DTB.

Introduce overlay_get_target_path() which directly handles the two
targeting cases that occur before fixup resolution:
 - target-path: the string property is returned directly.
 - target = <&label>: the label is found in the overlay's __fixups__
   node, then resolved to a path via the base DTB's __symbols__ node.

Libfdt fdt_for_each_property_offset() violates MISRA R20.7. Despite
libfdt being excluded from the analysis, this causes ECLAIR scan to
report a regression because the violation introduced by a macro is
reported at the call site. Deviate R20.7 for libfdt.h.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
This commit is contained in:
Michal Orzel committed 2026-04-29 07:37:58 +02:00
1 parent 9b1acd8124
commit 16579c5503
2 files changed
+61 -6

No files matched your search

@@ -629,8 +629,10 @@ of the IS_ENABLED or STATIC_IF/STATIC_IF_NOT macros, so it always receives a lit
not in scope for compliance are allowed, as that is imported code."
-file_tag+={gnu_efi_include, "^xen/include/efi/.*$"}
-file_tag+={acpi_cpu_idle, "^xen/arch/x86/acpi/cpu_idle\\.c$"}
-file_tag+={libfdt, "^xen/include/xen/libfdt/libfdt\\.h$"}
-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(gnu_efi_include)||any_exp(macro(^NextMemoryDescriptor$))))"}
-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(file(acpi_cpu_idle)))"}
-config=MC3A2.R20.7,reports+={safe, "any_area(any_loc(any_exp(file(libfdt))))"}
-doc_end
-doc_begin="To avoid compromising readability, the macros alternative_(v)?call[0-9] are allowed
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.