summaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2023-04-05 16:56:59 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2023-04-06 21:29:12 +0300
commit376b0fb3ad621ca507c1bdf5636232959bf827e6 (patch)
tree3f23d9a0c2abf3da344e845b4327cb3645f85466 /drivers/acpi
parent2a85fc5626797f9057311a419b1d5d847d86c527 (diff)
downloadlinux-376b0fb3ad621ca507c1bdf5636232959bf827e6.tar.xz
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 'drivers/acpi')
-rw-r--r--drivers/acpi/acpica/amlresrc.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/acpi/acpica/amlresrc.h b/drivers/acpi/acpica/amlresrc.h
index 48df447ef5bb..4e88f9fc2a28 100644
--- a/drivers/acpi/acpica/amlresrc.h
+++ b/drivers/acpi/acpica/amlresrc.h
@@ -261,7 +261,10 @@ struct aml_resource_address16 {
struct aml_resource_extended_irq {
AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
u8 interrupt_count;
- u32 interrupts[1];
+ union {
+ u32 interrupt;
+ ACPI_FLEX_ARRAY(u32, interrupts);
+ };
/* res_source_index, res_source optional fields follow */
};