From: sashiko-bot@kernel.org
To: guoqi0226 <guoqi0226@163.com>
Cc: "Oliver Hartkopp" <socketcan@hartkopp.net>,
"Oleksij Rempel" <o.rempel@pengutronix.de>,
"Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
linux-can@vger.kernel.org
Subject: Re: [PATCH v3 1/1] can: mcp251xfd: Add ACPI device ID table for MCP251XFD
Date: Tue, 16 Jun 2026 09:26:13 +0000 [thread overview]
Message-ID: <20260616092614.00ED51F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260616091640.93275-2-guoqi0226@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unconditional dereference of the pointer returned by spi_get_device_match_data() can cause a NULL pointer dereference.
--
commit 984f1d631588f571112e2f97f02bc97fcb1d8ec1
Author: guoqi0226 <guoqi0226@163.com>
can: mcp251xfd: Add ACPI device ID table for MCP251XFD
This patch adds an ACPI match table for the MCP251XFD CAN controller,
enabling driver binding on ACPI-enumerated SPI platforms.
> diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> index 92a86083c8962..0cde98f51f797 100644
> --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
> +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
[ ... ]
> @@ -2442,6 +2451,7 @@ static struct spi_driver mcp251xfd_driver = {
> .name = DEVICE_NAME,
> .pm = &mcp251xfd_pm_ops,
> .of_match_table = mcp251xfd_of_match,
> + .acpi_match_table = ACPI_PTR(mcp251xfd_acpi_match),
> },
> .probe = mcp251xfd_probe,
[Severity: High]
This isn't a bug introduced by this patch, but there is a pre-existing issue
in mcp251xfd_probe() that might cause a kernel panic.
If the SPI device is bound to the driver manually via sysfs (for example, by
writing to the driver_override and bind files), spi_get_device_match_data()
can return NULL.
In mcp251xfd_probe(), the return value is dereferenced unconditionally:
static int mcp251xfd_probe(struct spi_device *spi)
{
...
priv->devtype_data = *(struct mcp251xfd_devtype_data *)spi_get_device_match_data(spi);
...
}
Could we add a NULL check here that returns -ENODEV or falls back to a
default configuration to prevent the dereference?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260616091640.93275-1-guoqi0226@163.com?part=1
next prev parent reply other threads:[~2026-06-16 9:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260616031332.0F34C1F000E9@smtp.kernel.org 20260616-teal-wrasse-of-conversion-348af0-mkl@pengutronix.de>
2026-06-16 8:53 ` [PATCH v2 0/1] can: mcp251x: Add ACPI device ID table for MCP2515 guoqi0226
2026-06-16 8:53 ` [PATCH v2] can: mcp251xfd: Add ACPI device ID table for MCP251XFD guoqi0226
2026-06-16 9:07 ` sashiko-bot
2026-06-16 9:16 ` [PATCH v3 0/1] " guoqi0226
2026-06-16 9:16 ` [PATCH v3 1/1] " guoqi0226
2026-06-16 9:26 ` sashiko-bot [this message]
2026-06-16 10:30 ` [PATCH v4 0/2] " guoqi0226
2026-06-16 10:30 ` [PATCH v4 1/2] can: mcp251xfd: mcp251xfd: Cache and validate match data pointer in probe guoqi0226
2026-06-16 10:30 ` [PATCH v4 2/2] spi: Add NULL check for spi_get_device_id() in spi_get_device_match_data() guoqi0226
2026-06-16 10:45 ` sashiko-bot
2026-06-16 10:35 ` [PATCH v4 0/2] can: mcp251xfd: Add ACPI device ID table for MCP251XFD Mark Brown
[not found] ` <15819af8.9491.19ed00ac23e.Coremail.guoqi0226@163.com>
2026-06-16 10:51 ` Mark Brown
2026-06-16 10:52 ` guoqi0226
2026-06-16 9:45 ` [PATCH v2 0/1] can: mcp251x: Add ACPI device ID table for MCP2515 Marc Kleine-Budde
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=20260616092614.00ED51F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=guoqi0226@163.com \
--cc=linux-can@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=o.rempel@pengutronix.de \
--cc=sashiko-reviews@lists.linux.dev \
--cc=socketcan@hartkopp.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.