From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH RESEND v4] ACPI: SPCR: Support UART clock frequency field
Date: Fri, 04 Dec 2026 17:21:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-250298@kernel.org> (raw)
In-Reply-To: <20261204-acpi_spcr-v4-1-5bba4dc3e9b7@posteo.de>
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [Medium] ACPI: SPCR: missing length check for uart_clk_freq in
acpi_parse_spcr()
- [Low] ACPI: SPCR: undocumented magic number 3 in acpi_parse_spcr()
- [Low] serial: earlycon: missing __init on static inline
setup_earlycon()
--
commit 0e7844a447e5f6df6f024d1a47a751da8c370f1c
Author: Markus Probst <markus.probst@posteo.de>
ACPI: SPCR: Support UART clock frequency field
This commit adds setup_earlycon_with_uartclk() to accept an explicit UART
clock frequency and updates acpi_parse_spcr() to pass table->uart_clk_freq
when the SPCR table header revision is at least 3.
Link: https://learn.microsoft.com/en-us/windows-hardware/drivers/serports/serial-port-console-redirection-table
> diff --git a/drivers/acpi/spcr.c b/drivers/acpi/spcr.c
> index 73cb933fdc89b..c79c809f49d46 100644
> --- a/drivers/acpi/spcr.c
> +++ b/drivers/acpi/spcr.c
> @@ -228,7 +228,8 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
> pr_info("console: %s\n", opts);
>
> if (enable_earlycon)
> - setup_earlycon(opts);
> + setup_earlycon_with_uartclk(opts,
> + table->header.revision >= 3 ? table->uart_clk_freq : 0);
[Severity: Medium]
Can reading table->uart_clk_freq perform an out-of-bounds read on a
truncated SPCR table?
ACPICA maps only table->header.length bytes via acpi_os_map_memory()
(__early_ioremap() during early boot). On a truncated table with revision
3 or higher and length under 80 bytes, this reads past the mapping and can
fault on an unmapped fixmap page or corrupt the earlycon clock rate.
Checking table->header.length >= offsetofend(struct acpi_table_spcr,
uart_clk_freq) alongside the revision check would prevent this.
[Severity: Low]
As reported by Greg Kroah-Hartman on v3 [1], why is the bare magic number
3 used here? Adding a comment or named constant explaining that SPCR
specification revision 1.08 corresponds to table header revision 3 (which
introduced uart_clk_freq) would make this clearer.
[ ... ]
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index bdc214386e4a5..9b2bcd4295a97 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -1099,11 +1099,18 @@ int of_setup_earlycon(const struct earlycon_id *match, unsigned long node,
>
> #ifdef CONFIG_SERIAL_EARLYCON
> extern bool earlycon_acpi_spcr_enable __initdata;
> -int setup_earlycon(char *buf);
> +int setup_earlycon_with_uartclk(char *buf, unsigned int uart_clk_freq);
> #else
> static const bool earlycon_acpi_spcr_enable EARLYCON_USED_OR_UNUSED;
> -static inline int setup_earlycon(char *buf) { return 0; }
> +static inline int setup_earlycon_with_uartclk(char *buf, unsigned int uart_clk_freq)
> +{
> + return 0;
> +}
> #endif
> +static inline int setup_earlycon(char *buf)
> +{
> + return setup_earlycon_with_uartclk(buf, 0);
> +}
[Severity: Low]
Can this static inline setup_earlycon() wrapper trigger a modpost section
mismatch?
setup_earlycon_with_uartclk() is __init in drivers/tty/serial/earlycon.c,
and inline does not expand to __always_inline. If the compiler emits an
out-of-line copy of setup_earlycon() in .text, modpost reports a section
mismatch against .init.text.
Marking setup_earlycon() as static inline int __init avoids this.
[1] https://lore.kernel.org/r/2026071007-amaze-tartly-6282@gregkh
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-acpi_spcr-v4-1-5bba4dc3e9b7@posteo.de?part=1
next prev parent reply other threads:[~2026-12-04 17:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 16:59 [PATCH RESEND v4] ACPI: SPCR: Support UART clock frequency field Markus Probst
2026-12-04 17:21 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-13 14:28 Markus Probst
2026-11-13 14:36 ` sashiko-bot
2026-10-31 20:52 Markus Probst
2026-10-31 20:56 ` sashiko-bot
2026-10-16 18:05 Markus Probst
2026-10-16 18:17 ` sashiko-bot
2026-09-30 15:33 Markus Probst
2026-09-30 15:45 ` sashiko-bot
2026-09-30 17:35 ` Markus Probst
2026-09-13 16:17 Markus Probst
2026-09-13 16:23 ` sashiko-bot
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-250298@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=markus.probst@posteo.de \
--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