From: sashiko-bot@kernel.org
To: "Jacky Chou" <jacky_chou@aspeedtech.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 3/5] net: ftgmac100: Enable AST2700 RMII support
Date: Mon, 28 Sep 2026 07:21:34 +0000 [thread overview]
Message-ID: <20260928072135.6283E1F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260927-support_ast2700-v1-3-9f03f29d2c82@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()
--
commit ca665d10143bb849d0d5767a33bf55e0a57c8c94
Author: Jacky Chou <jacky_chou@aspeedtech.com>
net: ftgmac100: Enable AST2700 RMII support
This commit enables RMII support for the AST2700 MAC by adding a match-data
quirk. It programs the MAC for the selected interface mode by setting the RMII
enable bit when the port uses RMII.
> 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]
Does this code risk a NULL pointer dereference? If the device tree contains
an mdio child node but lacks a phy-handle property, ftgmac100_probe_dt()
returns successfully without configuring a PHY, leaving priv->netdev->phydev
as NULL.
When the network interface is brought up, could evaluating phydev->interface
cause a kernel panic?
[Severity: High]
This is a pre-existing issue, but I noticed the same pattern exists in
ftgmac100_reset_and_config_mac():
ftgmac100_reset_and_config_mac() {
...
if (priv->is_aspeed &&
priv->netdev->phydev->interface == PHY_INTERFACE_MODE_RMII) {
...
}
...
}
Could this also result in a panic under the same malformed device tree
conditions?
> + maccr |= FTGMAC100_MACCR_RMII_ENABLE;
> + }
> +
> /* Hit the HW */
> iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260927-support_ast2700-v1-0-9f03f29d2c82@aspeedtech.com?part=3
next prev parent reply other threads:[~2026-09-28 7:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 7:16 [PATCH 0/5] net: ftgmac100: Add AST2700 support Jacky Chou
2026-09-27 7:16 ` [PATCH 1/5] dt-bindings: net: ftgmac100: Add AST2700 compatible Jacky Chou
2026-09-30 10:06 ` Krzysztof Kozlowski
2026-09-30 21:17 ` netdev-bot+sashiko
2026-09-27 7:16 ` [PATCH 2/5] net: ftgmac100: Add AST2700 compatible support Jacky Chou
2026-09-30 21:17 ` netdev-bot+sashiko
2026-09-27 7:16 ` [PATCH 3/5] net: ftgmac100: Enable AST2700 RMII support Jacky Chou
2026-09-28 7:21 ` sashiko-bot [this message]
2026-09-30 21:18 ` netdev-bot+sashiko
2026-09-27 7:16 ` [PATCH 4/5] net: ftgmac100: Add AST2700 upper DMA address support Jacky Chou
2026-09-30 21:18 ` netdev-bot+sashiko
2026-09-27 7:16 ` [PATCH 5/5] net: ftgmac100: Allow building on ARM64 Jacky Chou
2026-09-30 21:18 ` netdev-bot+sashiko
2026-09-27 17:39 ` [PATCH 0/5] net: ftgmac100: Add AST2700 support Andrew Lunn
2026-09-29 7:12 ` 回覆: " Jacky Chou
2026-09-29 17:08 ` Andrew Lunn
2026-09-30 1:53 ` 回覆: " Jacky Chou
2026-09-30 12:55 ` Andrew Lunn
2026-10-02 5:53 ` 回覆: " 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=20260928072135.6283E1F00898@smtp.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