diff options
author | Kees Cook <kees@outflux.net> | 2023-03-01 14:42:10 -0800 |
---|---|---|
committer | Kees Cook <kees@outflux.net> | 2023-03-02 11:03:42 -0800 |
commit | 3c19ae70424e9ab1e1b805203d300d2660f9a2f7 (patch) | |
tree | a202b81706654e8f1778f2411cf7f5026e156e5e | |
parent | f4a3afd78c28dede0907f47951f0b73c9a776d4e (diff) | |
download | acpica-3c19ae70424e9ab1e1b805203d300d2660f9a2f7.tar.gz |
ACPI_DMAR_ANDD: Replace 1-element array with flexible array
Similar to commit 7ba2f3d91a32 ("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).
The handling of ACPI_DMAR_ANDD by AcpiDmDumpDmar() appears to expect a
single trailing char for calculating table offsets. Keep a char in the
union to avoid any code changes appearing in the .text or .data
sections.
Signed-off-by: Kees Cook <kees@outflux.net>
-rw-r--r-- | source/include/actbl1.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/include/actbl1.h b/source/include/actbl1.h index 63f137117..cecd7edbe 100644 --- a/source/include/actbl1.h +++ b/source/include/actbl1.h @@ -1219,7 +1219,10 @@ typedef struct acpi_dmar_andd ACPI_DMAR_HEADER Header; UINT8 Reserved[3]; UINT8 DeviceNumber; - char DeviceName[1]; + union { + char __pad; + ACPI_FLEX_ARRAY(char, DeviceName); + }; } ACPI_DMAR_ANDD; |