Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Claudiu Manoil" <claudiu.manoil@nxp.com>
Cc: conor+dt@kernel.org, Frank.Li@kernel.org, robh@kernel.org,
	imx@lists.linux.dev, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v1 1/5] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a DT overlay
Date: Sat, 10 Oct 2026 12:49:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-166542@kernel.org> (raw)
In-Reply-To: <5c38f45b9ff1d73c6942d42e23940ecd9ab7b71f.1791548316.git.claudiu.manoil@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] net: enetc: memory leak of partially applied overlay on of_overlay_fdt_apply() error
--

commit 8ec35cbb99007d6ea94d2243308ce4530bb6180d
Author: Claudiu Manoil <claudiu.manoil@nxp.com>

net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a DT overlay

This commit introduces pseudo-MAC support for ENETCv4 ports by modeling
them as fixed links. It uses a compiled device-tree overlay to synthesize
the fixed-link node at probe time when the port lacks an ethernet DT node
representation.

> diff --git a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> index 71c971618388b..7999355b5b9f5 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc4_pf.c
[ ... ]
> +static int enetc4_apply_overlay(struct enetc_ndev_priv *priv)
> +{
> +	u32 size = __dtbo_enetc4_pseudo_mac_end - __dtbo_enetc4_pseudo_mac_begin;
> +	struct device_node *np = dev_of_node(priv->dev);
> +	int err;
> +
> +	if (!np)
> +		return dev_err_probe(priv->dev, -ENODEV,
> +				     "Missing of_node for Pseudo-MAC port\n");
> +
> +	err = of_overlay_fdt_apply(__dtbo_enetc4_pseudo_mac_begin, size,
> +				   &priv->ovcs_id, np);
> +	if (err)
> +		return dev_err_probe(priv->dev, err,
> +				     "Failed to apply fixed-link overlay\n");

[Severity: Medium]
Can this leak the partially applied overlay changeset?

If of_overlay_fdt_apply() fails during application (for example, from a
post-apply notifier returning an error), it can return a negative error
code but still populate the changeset ID in priv->ovcs_id. Returning
immediately here without calling enetc4_put_overlay() bypasses cleaning up
the partially applied state.

Looking at the caller enetc4_link_init():

	err = enetc4_apply_overlay(priv);
	if (err)
		return err;

The error propagates directly and skips the err_mdiobus_create label
which would otherwise invoke enetc4_put_overlay() to handle the cleanup.

> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791548316.git.claudiu.manoil@nxp.com?part=1

  parent reply	other threads:[~2026-10-10 12:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1791548316.git.claudiu.manoil@nxp.com>
2026-10-09 12:40 ` [PATCH net-next v1 1/5] net: enetc: Add pseudo-MAC support for ENETCv4 Ports via a DT overlay Claudiu Manoil
2026-10-10  2:26   ` Frank Li
2026-10-10 12:49   ` sashiko-bot [this message]
2026-10-09 12:40 ` [PATCH net-next v1 2/5] net: enetc: Enable probing of version 4.4 devices Claudiu Manoil
2026-10-10  2:01   ` Wei Fang
2026-10-09 12:40 ` [PATCH net-next v1 3/5] arm64: dts: s32n79: add NETC IEP18 ECAM node for ENETC PPM ports Claudiu Manoil
2026-10-10 12:49   ` sashiko-bot
2026-10-09 12:40 ` [PATCH net-next v1 4/5] arm64: dts: s32n79-rdb: enable NETC IEP18 Claudiu Manoil

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=sashiko-outbox-166542@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=claudiu.manoil@nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox