Skip to content

Commit 49bd783

Browse files
keesrafaeljw
authored andcommitted
ACPICA: acpi_dmar_andd: Replace 1-element array with flexible array
ACPICA commit 3c19ae70424e9ab1e1b805203d300d2660f9a2f7 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). The handling of struct acpi_dmar_andd by acpi_dm_dump_dmar() 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. Link: acpica/acpica@3c19ae70 Signed-off-by: Kees Cook <kees@outflux.net> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 3a28793 commit 49bd783

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/acpi/actbl1.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,10 @@ struct acpi_dmar_andd {
901901
struct acpi_dmar_header header;
902902
u8 reserved[3];
903903
u8 device_number;
904-
char device_name[1];
904+
union {
905+
char __pad;
906+
ACPI_FLEX_ARRAY(char, device_name);
907+
};
905908
};
906909

907910
/* 5: SOC Integrated Address Translation Cache Reporting Structure */

0 commit comments

Comments
 (0)