Re: [PATCH v8 2/6] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop()

From: Rob Herring

Date: Wed Nov 18 2026 - 10:53:48 EST


On Wed, Oct 14, 2026 at 04:17:27PM -0700, Abdurrahman Hussain wrote:
> dup_and_fixup_symbol_prop() returns NULL for malformed values, for
> values that are not paths into one of the overlay's fragments, and
> for allocation failures. The caller reports all of them as -ENOMEM,
> so a structural problem in /__symbols__ is diagnosed as memory
> exhaustion.
>
> A later patch reuses the helper for /aliases values and must handle
> the three cases differently: copy verbatim, warn, or fail the apply.
> Return ERR_PTR(-EINVAL), ERR_PTR(-ENODEV) and ERR_PTR(-ENOMEM)
> respectively and propagate the errno in the /__symbols__ caller.
>
> Also verify that the value descends through the matched fragment's
> __overlay__ node before cutting the prefix. Only the first path
> component was resolved, so an absolute live-tree value sharing its
> first component with a fragment name was sliced at the prefix length
> and rewritten to garbage. A prefix mismatch returns -ENODEV.
>
> Signed-off-by: Abdurrahman Hussain <abdurrahman@xxxxxxxxxx>
> ---
> drivers/of/overlay.c | 35 ++++++++++++++++++++++++++---------
> 1 file changed, 26 insertions(+), 9 deletions(-)

This one seems useful on its own, so I applied it.

Rob