Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vasilij Strassheim" <v.strassheim@linutronix.de>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH net-next v3 5/8] net: mdio: Add SoC-e SWIP MDIO controller driver
Date: Thu, 24 Sep 2026 10:40:04 +0000	[thread overview]
Message-ID: <20260924104004.773F61F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260923-devel-vstrassheim-soce-dsa-ml-v3-5-ddebafcb9ba7@linutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mdio: null pointer dereference on devm_ioremap failure
--

commit b20b4c686880ab360f1cde6275ae5af3a5306146
Author: Vasilij Strassheim <v.strassheim@linutronix.de>

net: mdio: Add SoC-e SWIP MDIO controller driver
    
This commit adds a driver for the MDIO controller integrated into SoC-e
Ethernet switch IP cores. It supports Clause 22 and 45 transactions while
managing shared transaction control registers.

> diff --git a/drivers/net/mdio/mdio-soce.c b/drivers/net/mdio/mdio-soce.c
> new file mode 100644
> index 0000000000000..59c0b3da483eb
> --- /dev/null
> +++ b/drivers/net/mdio/mdio-soce.c
[ ... ]
> +static void __iomem *soce_mdio_iomap(struct device *dev, int index)
> +{
> +	struct resource res;
> +	int ret;
> +
> +	ret = of_address_to_resource(dev->of_node, index, &res);
> +	if (ret)
> +		return IOMEM_ERR_PTR(ret);
> +
> +	return devm_ioremap(dev, res.start, resource_size(&res));
> +}
[ ... ]
> +static int soce_mdio_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct soce_mdio *priv;
> +	struct mii_bus *bus;
> +
> +	bus = devm_mdiobus_alloc_size(dev, sizeof(*priv));
> +	if (!bus)
> +		return -ENOMEM;
> +
> +	priv = bus->priv;
> +	priv->data = soce_mdio_iomap(dev, SOCE_MDIO_DATA_IOMAP_IDX);
> +	if (IS_ERR(priv->data))
> +		return PTR_ERR(priv->data);
> +
> +	priv->ctrl = soce_mdio_iomap(dev, SOCE_MDIO_CTRL_IOMAP_IDX);
> +	if (IS_ERR(priv->ctrl))
> +		return PTR_ERR(priv->ctrl);

[Severity: High]
If devm_ioremap() fails in soce_mdio_iomap(), it returns NULL. Because
IS_ERR(NULL) evaluates to false, will this bypass the error check and allow
the driver to proceed with priv->data and priv->ctrl set to NULL?

If the driver proceeds with NULL pointers, will subsequent PHY accesses 
through soce_mdio_read() and soce_mdio_write() pass those NULL pointers to 
readl() and writel(), leading to a kernel panic?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-devel-vstrassheim-soce-dsa-ml-v3-0-ddebafcb9ba7@linutronix.de?part=5

  reply	other threads:[~2026-09-24 10:40 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 10:39 [PATCH net-next v3 0/8] net: dsa: Add SoC-e DSA driver Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 1/8] dt-bindings: vendor-prefixes: Add soce Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 2/8] dt-bindings: net: Add SoC-e SWIP MDIO controller Vasilij Strassheim
2026-09-25 22:55   ` Andrew Lunn
2026-09-30 14:00     ` Vasilij Strassheim
2026-09-30 15:14       ` Andrew Lunn
2026-09-30 17:13         ` Vasilij Strassheim
2026-09-30 18:24           ` Andrew Lunn
2026-10-05 20:01             ` Vasilij Strassheim
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-07  7:43     ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 3/8] dt-bindings: net: dsa: Add SoC-e SWIP switch Vasilij Strassheim
2026-09-25 23:05   ` Andrew Lunn
2026-09-30 17:16     ` Vasilij Strassheim
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-07 20:54   ` Rob Herring
2026-10-08  9:50     ` Vasilij Strassheim
2026-10-08 12:05       ` Andrew Lunn
2026-10-08 12:52         ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 4/8] net: dsa: Add tag handling for SoC-e switches Vasilij Strassheim
2026-09-24 10:40   ` sashiko-bot
2026-09-25 12:46     ` Vasilij Strassheim
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-07  9:09     ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 5/8] net: mdio: Add SoC-e SWIP MDIO controller driver Vasilij Strassheim
2026-09-24 10:40   ` sashiko-bot [this message]
2026-10-06  7:14     ` Vasilij Strassheim
2026-09-25 23:10   ` Andrew Lunn
2026-09-30 17:23     ` Vasilij Strassheim
2026-09-30 18:20       ` Andrew Lunn
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-07  9:31     ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 6/8] net: dsa: soce: Add basic support for SoC-e switch IP cores Vasilij Strassheim
2026-09-25 23:17   ` Andrew Lunn
2026-09-30 17:26     ` Vasilij Strassheim
2026-09-25 23:20   ` Andrew Lunn
2026-09-30 18:15     ` Vasilij Strassheim
2026-09-30 18:29       ` Andrew Lunn
2026-09-30 18:49         ` Vasilij Strassheim
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-07  9:55     ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 7/8] net: dsa: soce: Add VLAN offload support Vasilij Strassheim
2026-09-24 10:40   ` sashiko-bot
2026-10-06 12:52     ` Vasilij Strassheim
2026-09-25 23:32   ` Andrew Lunn
2026-09-30 18:32     ` Vasilij Strassheim
2026-09-27 12:28   ` netdev-bot+sashiko
2026-10-08 15:22     ` Vasilij Strassheim
2026-09-23 10:39 ` [PATCH net-next v3 8/8] net: dsa: soce: Disable unsupported hardware STP Vasilij Strassheim
2026-09-25 23:24   ` Andrew Lunn
2026-09-30 18:29     ` Vasilij Strassheim
2026-09-30 18:41       ` Andrew Lunn
2026-09-27 12:28   ` netdev-bot+sashiko

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=20260924104004.773F61F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=v.strassheim@linutronix.de \
    /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