From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796404879; b=qRbAYIC/etjRrZnNwqewv8eWHUqG03MpXoH6ElQSTvDwuHpVNQL1GogLIimMY7fH1/3a 6iDrwoNrP3MK2YeQAehQuRkcRFe13C+9ctgCPSu1movPYnhcPM8FSi65RWZfnLyvfqxHX QD5sB+i1f7Tc+4SJs9YecOlZT8LSWmIGZtVVSVY1D3gIvwM/pO7/3l7NaRSegMFbz7pXj g59bpdyUJ+Zp+gG9fB2eCZJGvxUq9GD8lREukNEOGA+yp3414G97XMlzHKoE7CeGdzT0J ipK7RSCMDqKe2WihGQz13xZyX2rIxDL7INmvZzJhEncBINUAmbrbD6O1hmtX6ry3U/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796404879; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=6WidUV6Tm8ZoAc8c4+xEHbv5pFD87YoG3JfPsxU4FOE=; b=d4Vi6YzANfoKg5/aNQZGcI6ahw5y7cIXgbmYEm3sAWA4R4+3VKF33FymazItlS9UpPln fiFtTmx/Lmz7Y52uNaJ68+Yt8KSy7lP5iZpvDP90TeH1Ei8M6ZIw4mSK5yGTYcr+SpiRo ZbTxBVSI6y+xiv4eoi1SH2XUB4wIoMQcg0Fl4rWBVLe+5fiTZ4gQqDs5mbeYvg+PXZsvv 6gjOOIizdlr5lBu0LT3D6Hut8hmNDau0UjC3bWq1C9g6FJu/XxzdaM42UnxD20zEgk6ha Itfxvr8I4r54JNamlf3eXWl4yVi+96RD/CiwtjPNBLIBoAguo10zcfK+GGj1+MrvA7Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VMPrwk+X; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 634BE606A334 for ; Fri, 4 Dec 2026 17:21:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=VMPrwk+X Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D91F1F0093B; Fri, 4 Dec 2026 17:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796404879; bh=6WidUV6Tm8ZoAc8c4+xEHbv5pFD87YoG3JfPsxU4FOE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=VMPrwk+X4twminShVnjm25y3nbrWodwKTVZjzGkSN7lsDPtoGDOjYj6DTCVqrsLF1 PgynwX6GiX+Mn+IsVtC2f73855mSL04vQi/zpXneKT0T4MUgQJFsdrQwqAcap76f5H WIwDv5GzkBrlvuuoBNtnUuJizQn6fyqhXed74Pde4XW+qhaqoSuq7I0Y55ld7j+Xdw vYW0yt+eaZ7udLM36b44oWb9fLGQ273DLx6OczYezjpHBCM9nOaL2DlTxKI+Tb0Fli OIjUBPF+pwuuWDFEx1Jouxlmg/NR+n1Z5M0DLc9+cqfs5aEqZmCTN/syygs+hkgCSX /KUT/jkcN+ndQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH RESEND v4] ACPI: SPCR: Support UART clock frequency field Reply-To: sashiko-reviews@lists.linux.dev To: "Markus Probst" Cc: linux-serial@vger.kernel.org In-Reply-To: <20261204-acpi_spcr-v4-1-5bba4dc3e9b7@posteo.de> References: <20261204-acpi_spcr-v4-1-5bba4dc3e9b7@posteo.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 17:21:18 +0000 X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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 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/s= erial-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); > =20 > if (enable_earlycon) > - setup_earlycon(opts); > + setup_earlycon_with_uartclk(opts, > + table->header.revision >=3D 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 >=3D 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 *m= atch, unsigned long node, > =20 > #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 ua= rt_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 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-acpi_spcr-= v4-1-5bba4dc3e9b7@posteo.de?part=3D1