summaryrefslogtreecommitdiffstats
path: root/include/acpi
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2023-04-05 15:56:59 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-04-06 20:29:12 +0200
commit376b0fb3ad621ca507c1bdf5636232959bf827e6 (patch)
tree3f23d9a0c2abf3da344e845b4327cb3645f85466 /include/acpi
parentACPICA: acpi_madt_oem_data: Fix flexible array member definition (diff)
downloadlinux-376b0fb3ad621ca507c1bdf5636232959bf827e6.tar.xz
linux-376b0fb3ad621ca507c1bdf5636232959bf827e6.zip
ACPICA: acpi_resource_irq: Replace 1-element arrays with flexible array
ACPICA commit bfdd3446e7caf795c85c70326c137023942972c5 Similar to "Replace one-element array with flexible-array", replace the 1-element array with a proper flexible array member as defined by C99. This allows the code to operate without tripping compile-time and run- time bounds checkers (e.g. via __builtin_object_size(), -fsanitize=bounds, and/or -fstrict-flex-arrays=3). Note that the spec requires there be at least one interrupt, so use a union to keep space allocated for this. The only binary change in .text and .data sections is some rearrangement by the compiler of acpi_dm_address_common(), but appears to be harmless. Link: https://github.com/acpica/acpica/commit/bfdd3446 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acrestyp.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 87d58afca79e..efef208b0324 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -142,7 +142,10 @@ struct acpi_resource_irq {
u8 shareable;
u8 wake_capable;
u8 interrupt_count;
- u8 interrupts[1];
+ union {
+ u8 interrupt;
+ ACPI_FLEX_ARRAY(u8, interrupts);
+ };
};
struct acpi_resource_dma {
@@ -335,7 +338,10 @@ struct acpi_resource_extended_irq {
u8 wake_capable;
u8 interrupt_count;
struct acpi_resource_source resource_source;
- u32 interrupts[1];
+ union {
+ u32 interrupt;
+ ACPI_FLEX_ARRAY(u32, interrupts);
+ };
};
struct acpi_resource_generic_register {