From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 3/3] usb: mtu3: add mt6595 support
Date: Tue, 22 Sep 2026 10:50:03 +0000 [thread overview]
Message-ID: <20260922105003.98C4C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260922-6595-mtu3-v2-3-71203a362b36@protonmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] usb: mtu3: missing NULL check for device_get_match_data result
--
commit d5e4ea09babd67818d32de7a95b82922101210c1
Author: Roman Vivchar <rva333@protonmail.com>
usb: mtu3: add mt6595 support
This commit adds platform data for the MediaTek mt6595 SoC to the MTU3 USB
driver. It introduces a quirk to enable single FIFO slot mode for this
specific platform.
> diff --git a/drivers/usb/mtu3/mtu3_plat.c b/drivers/usb/mtu3/mtu3_plat.c
> index bb67da4704b29..9d633695a9bed 100644
> --- a/drivers/usb/mtu3/mtu3_plat.c
> +++ b/drivers/usb/mtu3/mtu3_plat.c
> @@ -611,11 +611,16 @@ static const struct dev_pm_ops mtu3_pm_ops = {
>
> #define DEV_PM_OPS (IS_ENABLED(CONFIG_PM) ? &mtu3_pm_ops : NULL)
>
> +static const struct mtu3_platform_data mt6595_platform_data = {
> + .fifo_single_slot = true,
> +};
> +
> static const struct mtu3_platform_data mt8173_platform_data = {
> .fifo_single_slot = false,
> };
>
> static const struct of_device_id mtu3_of_match[] = {
> + { .compatible = "mediatek,mt6595-mtu3", .data = &mt6595_platform_data },
[Severity: High]
Does this code allow an unprotected dereference of pdata if matched without
OF data?
The mtu3 platform driver allows matching by name (via .driver.name = "mtu3"),
in which case device_get_match_data() returns NULL because there is no
corresponding id_table with driver_data.
The mtu3_probe() function gracefully tolerates a missing of_node, allowing
execution to reach ssusb_gadget_init(), where pdata->fifo_single_slot is
unconditionally dereferenced:
drivers/usb/mtu3/mtu3_core.c:ssusb_gadget_init() {
...
mtu->fifo_single_slot = pdata->fifo_single_slot;
...
}
While typically bound via device tree, manual binding via sysfs or missing
.data in future OF match entries will trigger a kernel panic (Oops) here.
> { .compatible = "mediatek,mt8173-mtu3", .data = &mt8173_platform_data },
> { .compatible = "mediatek,mtu3", .data = &mt8173_platform_data },
> {},
> };
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260922-6595-mtu3-v2-0-71203a362b36@protonmail.com?part=3
next prev parent reply other threads:[~2026-09-22 10:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-22 10:36 [PATCH v2 0/3] usb: mtu3: add mt6595 support Roman Vivchar via B4 Relay
2026-09-22 10:36 ` [PATCH v2 1/3] dt-bindings: usb: mtu3: add mt6595 Roman Vivchar via B4 Relay
2026-09-22 10:44 ` sashiko-bot
2026-09-28 7:51 ` Krzysztof Kozlowski
2026-09-22 10:36 ` [PATCH v2 2/3] usb: mtu3: add SoC platform data for FIFO quirk handling Roman Vivchar via B4 Relay
2026-09-22 11:46 ` AngeloGioacchino Del Regno
2026-09-22 10:36 ` [PATCH v2 3/3] usb: mtu3: add mt6595 support Roman Vivchar via B4 Relay
2026-09-22 10:50 ` sashiko-bot [this message]
2026-09-22 11:46 ` AngeloGioacchino Del Regno
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=20260922105003.98C4C1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rva333@protonmail.com \
--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