From: sashiko-bot@kernel.org
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH V3 2/4 net-next?] net: dsa: b53: prefer CPU port 8 for Northstar devices
Date: Thu, 13 Aug 2026 13:40:43 +0000 [thread overview]
Message-ID: <20260813134043.F18F51F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260812132755.32585-2-zajec5@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing NULL pointer check on the result of `dsa_to_port()` before passing it to `dsa_port_is_cpu()`, leading to a potential NULL pointer dereference.
--
--- Patch [2]: [PATCH V3 2/4 net-next?] net: dsa: b53: prefer CPU port 8 for Northstar devices ---
commit 2ae0d011f243e38dabfab275559b868d62bf66f6
Author: Rafał Miłecki <rafal@milecki.pl>
net: dsa: b53: prefer CPU port 8 for Northstar devices
This patch prefers CPU port 8 if available for Northstar devices. Ports
5 and 7 have limitations with CPU trapping features compared to port 8.
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index 5fd8362d04304..052812d2faa93 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
[ ... ]
> +static struct dsa_port *b53_preferred_default_local_cpu_port(struct dsa_switch *ds)
> +{
> + struct b53_device *dev = ds->priv;
> + struct dsa_port *cpu_dp;
[ ... ]
> + if (is5301x(dev)) {
> + cpu_dp = dsa_to_port(ds, B53_CPU_PORT);
> +
> + if (dsa_port_is_cpu(cpu_dp))
[Severity: High]
Does this code risk a NULL pointer dereference during device probe?
If a Northstar SoC is configured without port 8 (for example, in setups
using only port 5 or 7 as the CPU port), dsa_to_port() will return NULL.
The dsa_port_is_cpu() function dereferences the passed port pointer directly:
include/net/dsa.h:dsa_port_is_cpu() {
return port->type == DSA_PORT_TYPE_CPU;
}
Passing NULL to dsa_port_is_cpu() would cause a panic. Could cpu_dp be
checked for NULL before calling dsa_port_is_cpu()?
> + return cpu_dp;
> + }
> +
> + return NULL;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260812132755.32585-1-zajec5@gmail.com?part=2
next prev parent reply other threads:[~2026-08-13 13:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 13:27 [PATCH V3 1/4 net] net: dsa: b53: deal with Northstar devices using CPU port 5 or 7 Rafał Miłecki
2026-08-12 13:27 ` [PATCH V3 2/4 net-next?] net: dsa: b53: prefer CPU port 8 for Northstar devices Rafał Miłecki
2026-08-13 13:40 ` sashiko-bot [this message]
2026-08-12 13:27 ` [PATCH V3 3/4] ARM: dts: BCM5301X: drop pointless "cpu" labels from switch CPU ports Rafał Miłecki
2026-08-12 13:27 ` [PATCH V3 4/4] ARM: dts: BCM5301X: Enable extra CPU ports for Netgear R8000 Rafał Miłecki
2026-08-13 10:53 ` [PATCH V3 1/4 net] net: dsa: b53: deal with Northstar devices using CPU port 5 or 7 Semih Baskan
2026-08-13 19:08 ` Vladimir Oltean
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=20260813134043.F18F51F00A3A@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=zajec5@gmail.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