Skip to content

Commit 3a28793

Browse files
keesrafaeljw
authored andcommitted
ACPICA: acpi_pci_routing_table: Replace fixed-size array with flex array member
ACPICA commit f4a3afd78c28dede0907f47951f0b73c9a776d4e The "Source" array is actually a dynamically sized array, but it is defined as a fixed-size 4 byte array. This results in tripping both compile-time and run-time bounds checkers (e.g. via either __builtin_object_size() or -fsanitize=bounds). To retain the padding, create a union with an unused Pad variable of size 4, and redefine Source as a proper flexible array member. No binary changes appear in the .text nor .data sections. Link: acpica/acpica@f4a3afd7 Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 6671709 commit 3a28793

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/acpi/acrestyp.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,10 @@ struct acpi_pci_routing_table {
693693
u32 pin;
694694
u64 address; /* here for 64-bit alignment */
695695
u32 source_index;
696-
char source[4]; /* pad to 64 bits so sizeof() works in all cases */
696+
union {
697+
char pad[4]; /* pad to 64 bits so sizeof() works in all cases */
698+
ACPI_FLEX_ARRAY(char, source);
699+
};
697700
};
698701

699702
#endif /* __ACRESTYP_H__ */

0 commit comments

Comments
 (0)