aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2025-04-25 21:27:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-10 07:17:08 -0400
commitf1c9331f77e7a826ec2e7b45a52b8cc389348405 (patch)
treeeb9894f743b135d8cea73cc74f4704aad5d1cd7b
parentRevert "x86/smp: Eliminate mwait_play_dead_cpuid_hint()" (diff)
downloadlaptop-kernel-f1c9331f77e7a826ec2e7b45a52b8cc389348405.tar.xz
laptop-kernel-f1c9331f77e7a826ec2e7b45a52b8cc389348405.zip
ACPICA: Introduce ACPI_NONSTRING
commit 6da5e6f3028d46e4fee7849e85eda681939c630b upstream. ACPICA commit 878823ca20f1987cba0c9d4c1056be0d117ea4fe In order to distinguish character arrays from C Strings (i.e. strings with a terminating NUL character), add support for the "nonstring" attribute provided by GCC. (A better name might be "ACPI_NONCSTRING", but that's the attribute name, so stick to the existing naming convention.) GCC 15's -Wunterminated-string-initialization will warn about truncation of the NUL byte for string initializers unless the destination is marked with "nonstring". Prepare for applying this attribute to the project. Link: https://github.com/acpica/acpica/commit/878823ca Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/1841930.VLH7GnMWUR@rjwysocki.net Signed-off-by: Kees Cook <kees@kernel.org> [ rjw: Pick up the tag from Kees ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: Jiri Slaby <jirislaby@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--include/acpi/actypes.h4
-rw-r--r--include/acpi/platform/acgcc.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 80767e8bf3ad..f7b3c4a4b7e7 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1327,4 +1327,8 @@ typedef enum {
#define ACPI_FLEX_ARRAY(TYPE, NAME) TYPE NAME[0]
#endif
+#ifndef ACPI_NONSTRING
+#define ACPI_NONSTRING /* No terminating NUL character */
+#endif
+
#endif /* __ACTYPES_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 04b4bf620517..68e9379623e6 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -72,4 +72,12 @@
TYPE NAME[]; \
}
+/*
+ * Explicitly mark strings that lack a terminating NUL character so
+ * that ACPICA can be built with -Wunterminated-string-initialization.
+ */
+#if __has_attribute(__nonstring__)
+#define ACPI_NONSTRING __attribute__((__nonstring__))
+#endif
+
#endif /* __ACGCC_H__ */