From: sashiko-bot@kernel.org
To: "Abdurrahman Hussain" <abdurrahman@nexthop.ai>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 5/7] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop()
Date: Wed, 22 Jul 2026 07:24:44 +0000 [thread overview]
Message-ID: <20260722072444.DD96E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722-nh-of-alias-overlay-v4-5-fc96a40d2761@nexthop.ai>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] When an overlay targets the root node (`/`), `dup_and_fixup_symbol_prop` creates malformed device tree paths with a double slash (`//`), preventing the symbol or alias from being resolved.
--
--- Patch [5]: [PATCH v4 5/7] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop() ---
commit 5d340ac0a28e3bab97719502d9467e332f065d74
Author: Abdurrahman Hussain <abdurrahman@nexthop.ai>
of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop()
This commit modifies dup_and_fixup_symbol_prop() to return distinct ERR_PTR
values instead of NULL for different failure cases. It also adds verification
to ensure the value descends through the matched fragment's __overlay__ node
before slicing it.
> diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
> index 284c9bc6c9cfc..d4d2591e735ac 100644
> --- a/drivers/of/overlay.c
> +++ b/drivers/of/overlay.c
[ ... ]
> @@ -243,18 +249,27 @@ static struct property *dup_and_fixup_symbol_prop(
[ ... ]
> path_tail = path + overlay_name_len;
> path_tail_len = strlen(path_tail);
>
> target_path = kasprintf(GFP_KERNEL, "%pOF", fragment->target);
> if (!target_path)
> - return NULL;
> + return ERR_PTR(-ENOMEM);
> target_path_len = strlen(target_path);
>
[Severity: High]
This is a pre-existing issue, but since the commit message notes this helper
is being prepared for /aliases, could the concatenation of target_path and
path_tail further down in dup_and_fixup_symbol_prop() create invalid paths
when the overlay targets the root node?
When fragment->target is the root node, target_path evaluates to "/". If
path_tail references a fragment-internal path and starts with a slash
(e.g., "/my_node"), unconditionally concatenating them without deduplicating
the connecting slash creates a path like "//my_node":
memcpy(new_prop->value, target_path, target_path_len);
memcpy(new_prop->value + target_path_len, path_tail, path_tail_len);
Because __of_find_node_by_full_path() fails on empty path components, any
alias or symbol in an overlay targeting the root node will silently fail to
resolve. Does this need to be addressed so drivers relying on these aliases
do not fail to probe?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-nh-of-alias-overlay-v4-0-fc96a40d2761@nexthop.ai?part=5
next prev parent reply other threads:[~2026-07-22 7:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 7:14 [PATCH v4 0/7] of: teach overlay code to keep /aliases in sync Abdurrahman Hussain
2026-07-22 7:14 ` [PATCH v4 1/7] of: resolve alias-prefixed paths under devtree_lock Abdurrahman Hussain
2026-07-22 7:14 ` [PATCH v4 2/7] of: incrementally update /aliases lookup on reconfig notifications Abdurrahman Hussain
2026-07-22 7:14 ` [PATCH v4 3/7] of/overlay: look up absolute target-paths absolutely Abdurrahman Hussain
2026-07-22 7:25 ` sashiko-bot
2026-07-22 7:14 ` [PATCH v4 4/7] of/overlay: put property on deadprops only after changeset add succeeds Abdurrahman Hussain
2026-07-22 7:14 ` [PATCH v4 5/7] of/overlay: return ERR_PTR from dup_and_fixup_symbol_prop() Abdurrahman Hussain
2026-07-22 7:24 ` sashiko-bot [this message]
2026-07-22 7:14 ` [PATCH v4 6/7] of/overlay: rewrite /aliases path values to live-tree paths Abdurrahman Hussain
2026-07-22 7:14 ` [PATCH v4 7/7] of: unittest: cover /aliases updates from overlay apply/revert Abdurrahman Hussain
2026-07-22 7:35 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722072444.DD96E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=abdurrahman@nexthop.ai \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.