[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2656292.X9hSmTKtgW@kreacher>
Date: Wed, 05 Apr 2023 15:54:25 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux ACPI <linux-acpi@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Bob Moore <robert.moore@...el.com>,
Kees Cook <kees@...flux.net>
Subject: [PATCH 26/32] ACPICA: acpi_pci_routing_table: Replace fixed-size array with flex array member
From: Kees Cook <kees@...flux.net>
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: https://github.com/acpica/acpica/commit/f4a3afd7
Signed-off-by: Bob Moore <robert.moore@...el.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---
include/acpi/acrestyp.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/acpi/acrestyp.h b/include/acpi/acrestyp.h
index 52e82d65016b..4c3b7b393f82 100644
--- a/include/acpi/acrestyp.h
+++ b/include/acpi/acrestyp.h
@@ -693,7 +693,10 @@ struct acpi_pci_routing_table {
u32 pin;
u64 address; /* here for 64-bit alignment */
u32 source_index;
- char source[4]; /* pad to 64 bits so sizeof() works in all cases */
+ union {
+ char pad[4]; /* pad to 64 bits so sizeof() works in all cases */
+ ACPI_FLEX_ARRAY(char, source);
+ };
};
#endif /* __ACRESTYP_H__ */
--
2.35.3
Powered by blists - more mailing lists