From: sashiko-bot@kernel.org
To: "Jacky Chou" <jacky_chou@aspeedtech.com>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/6] net: ftgmac100: Enable AST2700 RMII support
Date: Wed, 07 Oct 2026 07:21:11 +0000 [thread overview]
Message-ID: <sashiko-outbox-162706@kernel.org> (raw)
In-Reply-To: <20261006-support_ast2700-v2-3-36de51fb8066@aspeedtech.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] net: ftgmac100: NULL pointer dereference in ftgmac100_start_hw() on missing PHY
--
commit 9ce856b5087337010253eb3a985d1756ba877130
Author: Jacky Chou <jacky_chou@aspeedtech.com>
net: ftgmac100: Enable AST2700 RMII support
This commit adds a match-data quirk to set the RMII enable bit when an AST2700
port uses RMII. This ensures the MAC is programmed correctly for the selected
interface mode.
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 67b1fa464a421..b835472da3604 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
[ ... ]
> @@ -355,6 +359,7 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
> static void ftgmac100_start_hw(struct ftgmac100 *priv)
> {
> u32 maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR);
> + struct phy_device *phydev = priv->netdev->phydev;
>
> /* Keep the original GMAC and FAST bits */
> maccr &= (FTGMAC100_MACCR_FAST_MODE | FTGMAC100_MACCR_GIGA_MODE);
> @@ -383,6 +388,11 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv)
> if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
> maccr |= FTGMAC100_MACCR_RM_VLAN;
>
> + if ((priv->quirks & FTGMAC100_QUIRK_RMII_ENABLE) &&
> + phydev->interface == PHY_INTERFACE_MODE_RMII) {
[Severity: High]
Could phydev be NULL here?
If the driver probes an AST2700 device tree that lacks a phy-handle (or
fixed-link / use-ncsi) but contains an mdio child node, ftgmac100_probe_dt()
will exit successfully while leaving priv->netdev->phydev as NULL.
When the interface is subsequently brought up (e.g., via ip link set up),
ftgmac100_open() calls ftgmac100_start_hw() prior to verifying if a PHY exists.
Since the AST2700 quirk is enabled, could evaluating phydev->interface cause a
NULL pointer dereference and kernel panic?
> + maccr |= FTGMAC100_MACCR_RMII_ENABLE;
> + }
> +
> /* Hit the HW */
> iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261006-support_ast2700-v2-0-36de51fb8066@aspeedtech.com?part=3
next prev parent reply other threads:[~2026-10-07 7:21 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-06 7:20 [PATCH net-next v2 0/6] net: ftgmac100: Add AST2700 support Jacky Chou
2026-10-06 7:20 ` [PATCH net-next v2 1/6] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
2026-10-07 7:21 ` sashiko-bot
2026-10-06 7:20 ` [PATCH net-next v2 2/6] net: ftgmac100: Add AST2700 compatible support Jacky Chou
2026-10-06 16:22 ` Andrew Lunn
2026-10-06 7:20 ` [PATCH net-next v2 3/6] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
2026-10-06 16:31 ` Andrew Lunn
2026-10-08 5:39 ` 回覆: " Jacky Chou
2026-10-08 12:00 ` Andrew Lunn
2026-10-08 12:10 ` 回覆: " Jacky Chou
2026-10-07 7:21 ` sashiko-bot [this message]
2026-10-06 7:20 ` [PATCH net-next v2 4/6] net: ftgmac100: Require phy-mode for AST2700 Jacky Chou
2026-10-06 16:21 ` Andrew Lunn
2026-10-08 5:20 ` 回覆: " Jacky Chou
2026-10-07 7:21 ` sashiko-bot
2026-10-06 7:20 ` [PATCH net-next v2 5/6] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
2026-10-06 7:20 ` [PATCH net-next v2 6/6] net: ftgmac100: Allow building on ARM64 Jacky Chou
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-162706@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jacky_chou@aspeedtech.com \
--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