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 10/13] net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
Date: Thu, 15 Oct 2026 13:19:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-172920@kernel.org> (raw)
In-Reply-To: <20261014131906.990077-11-prabhakar.mahadev-lad.rj@bp.renesas.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] net: dsa: rzn1-a5psw: null pointer deref in probe on sysfs bind
- [Medium] net: dsa: tag_rzn1_a5psw: broken module auto-loading due to incorrect macro protocol ID
--
commit fb10d951639e543773ea24357094717bd055958c
Author: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
net: dsa: rzn1-a5psw: Choose tagging protocol based on compatible string
This commit makes the DSA tag protocol selectable through SoC match data
to prepare the driver for the forthcoming RZ/T2H ETHSW support. It uses
the compatible string to select the appropriate tagging protocol while
preserving the existing RZ/N1 behavior.
> diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
> index 85ff1fd2bbfba..0b0b4055e6155 100644
> --- a/drivers/net/dsa/rzn1_a5psw.c
> +++ b/drivers/net/dsa/rzn1_a5psw.c
> @@ -1223,7 +1230,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 cause a NULL pointer dereference?
If the platform device is bound via sysfs, the device is matched by driver
name rather than via device tree. In this case, of_device_get_match_data(dev)
will return NULL in a5psw_probe(), leaving a5psw->of_data as NULL.
When BIT(a5psw->of_data->cpu_port) is evaluated, it will dereference the NULL
pointer, which transforms a previously safe error path into a panic.
[ ... ]
> diff --git a/net/dsa/tag_rzn1_a5psw.c b/net/dsa/tag_rzn1_a5psw.c
> index 734910156dc33..3dff661fa58cb 100644
> --- a/net/dsa/tag_rzn1_a5psw.c
> +++ b/net/dsa/tag_rzn1_a5psw.c
> @@ -112,8 +112,24 @@ static const struct dsa_device_ops a5psw_netdev_ops = {
> .rcv = a5psw_tag_rcv,
> .needed_headroom = A5PSW_TAG_LEN,
> };
> +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_A5PSW, A5PSW_NAME);
[Severity: Medium]
Is this macro protocol ID correct?
The protocol macro DSA_TAG_PROTO_A5PSW does not exist. The correct macro
is DSA_TAG_PROTO_RZN1_A5PSW.
Because DSA_TAG_PROTO_A5PSW_VALUE is undefined, the C preprocessor stringifies
it literally as "DSA_TAG_PROTO_A5PSW_VALUE" rather than expanding it to "26".
This causes the module alias to be registered as
"dsa_tag:id-DSA_TAG_PROTO_A5PSW_VALUE" instead of "dsa_tag:id-26", which
breaks module auto-loading for the tag driver.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014131906.990077-1-prabhakar.mahadev-lad.rj@bp.renesas.com?part=10
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
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 [this message]
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-172920@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