Re: [PATCH v8 1/6] of/overlay: look up absolute target-paths absolutely
From: Rob Herring
Date: Wed Nov 18 2026 - 10:51:09 EST
On Wed, Oct 14, 2026 at 04:17:26PM -0700, Abdurrahman Hussain wrote:
> find_target() with a non-NULL target base concatenates the base path
> and the fragment's target-path via "%pOF%s": target-path="/foo"
> resolves to "<base>/foo" and can never reach the DT root. An overlay
> applied with a base cannot both extend the base subtree and add
> /aliases entries, which is what a PCI device declaring its
> peripherals under dev_of_node() needs for alias-based bus numbering.
The current behavior seems correct to me. The overlay should not modify
anything above target_base. Correct or not, couldn't someone be relying
on current behavior?
>
> Treat any non-empty target-path as absolute. An empty target-path
> still means the base itself, the only form used by the one in-tree
> caller passing a base (drivers/misc/lan966x_pci.c).
>
> Spell the contract out in the kernel-doc for @base/@target_base and
> in find_target()'s strategy comment.
>
> Signed-off-by: Abdurrahman Hussain <abdurrahman@xxxxxxxxxx>
> ---
> drivers/of/overlay.c | 38 ++++++++++++++++++--------------------
> 1 file changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 83c56dd9b5d8..6f2d7872028a 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
> @@ -692,12 +692,15 @@ static int build_changeset(struct overlay_changeset *ovcs)
> *
> * 1) "target" property containing the phandle of the target
> * 2) "target-path" property containing the path of the target
> + *
> + * With a non-NULL @target_base, an empty "target-path" means
> + * @target_base itself; any non-empty "target-path" is resolved
> + * absolutely from the live-tree root.
If we are going to improve this, it should also define what NULL
@target_base means.
Rob