From: sashiko-bot@kernel.org
To: Prabhakar <prabhakar.csengg@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
wsa+renesas@sang-engineering.com
Subject: Re: [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data
Date: Thu, 15 Oct 2026 13:19:31 +0000 [thread overview]
Message-ID: <sashiko-outbox-172919@kernel.org> (raw)
In-Reply-To: <20261014131906.990077-10-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: dsa: rzn1-a5psw: missing NULL check for of_device_get_match_data
--
commit d0e877d4584f59434a728598a2547f8f5e97b982
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Get switch info via OF data
This commit introduces an a5psw_of_data structure to hold per-SoC switch
information, replacing previously embedded constants to support newer hardware
variants with different port counts.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index bdfa84745eda4..c8197ef62fd2d 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
[ ... ]
> @@ -1226,7 +1228,8 @@ static int a5psw_probe(struct platform_device *pdev)
> if (IS_ERR(a5psw->base))
> return PTR_ERR(a5psw->base);
>
> - a5psw->bridged_ports = BIT(A5PSW_CPU_PORT);
> + a5psw->of_data = of_device_get_match_data(dev);
> + a5psw->bridged_ports = BIT(a5psw->of_data->cpu_port);
[Severity: High]
Does this code dereference a NULL pointer if the driver is bound via sysfs?
If a privileged user manually binds the driver to a platform device via sysfs
(e.g., using /sys/bus/platform/drivers/rzn1_a5psw/bind) that lacks a device
tree node (dev->of_node is NULL), of_device_get_match_data() will return NULL.
Since a5psw->of_data is dereferenced immediately on the next line in
a5psw_probe() without any validation, this could lead to a kernel panic during
probe. Could a check be added here to safely handle a missing OF match?
>
> ret = a5psw_pcs_get(a5psw);
> if (ret)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=9
next prev parent reply other threads:[~2026-10-15 13:19 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 13:18 [PATCH net-next v3 00/13] Add ETHSW support for Renesas RZ/T2H and RZ/N2H SoCs Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 01/13] net: dsa: tag_rzn1_a5psw: Drop redundant ETH_P_DSA_A5PSW definition Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 02/13] net: dsa: tag_rzn1_a5psw: Add RZ/T2H ETHSW tag protocol support Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 03/13] net: dsa: Kconfig: Expand config description to cover RZ/T2H and RZ/N2H ETHSW Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 04/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Disallow ports beyond port@4 Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-15 20:37 ` Rob Herring
2026-10-14 13:18 ` [PATCH net-next v3 05/13] dt-bindings: net: dsa: renesas,rzn1-a5psw: Add RZ/T2H and RZ/N2H ETHSW support Prabhakar
2026-10-15 20:39 ` Rob Herring (Arm)
2026-10-14 13:18 ` [PATCH net-next v3 06/13] net: dsa: rzn1-a5psw: Add support for optional reset control Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 07/13] net: dsa: rzn1-a5psw: Add support for optional timestamp clock Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 08/13] net: dsa: rzn1-a5psw: Make use dev_err_probe() Prabhakar
2026-10-14 13:18 ` [PATCH net-next v3 09/13] net: dsa: rzn1-a5psw: Get switch info via OF data Prabhakar
2026-10-15 13:19 ` sashiko-bot [this message]
2026-10-14 13:18 ` [PATCH net-next v3 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:18 ` [PATCH net-next v3 11/13] net: dsa: rzn1-a5psw: Add fixed frame length workaround for management port Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 12/13] net: dsa: rzn1-a5psw: Add support for RZ/T2H Ethernet switch Prabhakar
2026-10-15 13:19 ` sashiko-bot
2026-10-14 13:19 ` [PATCH net-next v3 13/13] net: dsa: Kconfig: Enable support for RZ/T2H and RZ/N2H SoCs Prabhakar
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-172919@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.com \
/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