Skip to content

Commit 2a5ab99

Browse files
keesrafaeljw
authored andcommitted
ACPICA: struct acpi_nfit_interleave: Replace 1-element array with flexible array
ACPICA commit e66decc6fca36b59194b0947d87d6a9bec078bc3 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). Unlike struct acpi_nfit_flush_address and struct acpi_nfit_smbios, which had their sizeof() uses adjusted in code, struct acpi_nfit_interleave did not. This appears to have been a bug. After this change, there is a binary difference in acpi_dm_dump_nfit() since the size of the structure now has the correct size, as the prior result was including the trailing U32: - mov $0x14,%ebp + mov $0x10,%ebp Link: acpica/acpica@e66decc6 Signed-off-by: Bob Moore <robert.moore@intel.com> Reviewed-by: Dan Williams <dan.j.williams@intel.com> Tested-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 74522fe commit 2a5ab99

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/acpi/nfit/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3476,7 +3476,7 @@ static __init int nfit_init(void)
34763476
BUILD_BUG_ON(sizeof(struct acpi_table_nfit) != 40);
34773477
BUILD_BUG_ON(sizeof(struct acpi_nfit_system_address) != 64);
34783478
BUILD_BUG_ON(sizeof(struct acpi_nfit_memory_map) != 48);
3479-
BUILD_BUG_ON(sizeof(struct acpi_nfit_interleave) != 20);
3479+
BUILD_BUG_ON(sizeof(struct acpi_nfit_interleave) != 16);
34803480
BUILD_BUG_ON(sizeof(struct acpi_nfit_smbios) != 8);
34813481
BUILD_BUG_ON(sizeof(struct acpi_nfit_control_region) != 80);
34823482
BUILD_BUG_ON(sizeof(struct acpi_nfit_data_region) != 40);

include/acpi/actbl2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ struct acpi_nfit_interleave {
17001700
u16 reserved; /* Reserved, must be zero */
17011701
u32 line_count;
17021702
u32 line_size;
1703-
u32 line_offset[1]; /* Variable length */
1703+
u32 line_offset[]; /* Variable length */
17041704
};
17051705

17061706
/* 3: SMBIOS Management Information Structure */

0 commit comments

Comments
 (0)