lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251217093304.116728-1-fengchenguang@kylinos.cn>
Date: Wed, 17 Dec 2025 17:33:04 +0800
From: fengchenguang@...inos.cn
To: rafael@...nel.org
Cc: lenb@...nel.org,
	robert.moore@...el.com,
	linux-acpi@...r.kernel.org,
	acpica-devel@...ts.linux.dev,
	linux-kernel@...r.kernel.org,
	fengchenguang <fengchenguang@...inos.cn>,
	k2ci <kernel-bot@...inos.cn>
Subject: [PATCH] ACPICA: Fix RSDP signature validation to avoid -Wstringop-overread

From: fengchenguang <fengchenguang@...inos.cn>

The RSDP signature is an 8-byte binary identifier,not a NUL-terminated
C string. Using strncmp() on it triggers a -Wstringop-overread warning
with GCC 8+, because the source operand is smaller than the requested
compare length of 8 bytes.

Replace strncmp() with memcmp() for exact 8-byte binary comparison,
and remove the redundant (sizeof(a) < 8) conditional, as the RSDP
signature field is always 8 bytes per the ACPI specification.

Reported-by: k2ci <kernel-bot@...inos.cn>
Signed-off-by: fengchenguang <fengchenguang@...inos.cn>
---
 include/acpi/actypes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 8fe893d776dd..3714b197b1dd 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -527,7 +527,7 @@ typedef u64 acpi_integer;
 
 /* Support for the special RSDP signature (8 characters) */
 
-#define ACPI_VALIDATE_RSDP_SIG(a)       (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, (sizeof(a) < 8) ? ACPI_NAMESEG_SIZE : 8))
+#define ACPI_VALIDATE_RSDP_SIG(a)       (!memcmp(ACPI_CAST_PTR(char, (a)), ACPI_SIG_RSDP, 8))
 #define ACPI_MAKE_RSDP_SIG(dest)        (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
 
 /* Support for OEMx signature (x can be any character) */
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ