summaryrefslogtreecommitdiff
path: root/include/linux/efi.h
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2024-07-11 10:11:13 -0700
committerArd Biesheuvel <ardb@kernel.org>2024-07-12 10:06:01 +0200
commit4a2ebb082297f41803742729642961532e54079e (patch)
tree518aa4fa1429af07a0db955b75234a0fdefaf838 /include/linux/efi.h
parent887c4cf5594a073fd60c0df84150eb06d78c6406 (diff)
efi: Replace efi_memory_attributes_table_t 0-sized array with flexible array
While efi_memory_attributes_table_t::entry isn't used directly as an array, it is used as a base for pointer arithmetic. The type is wrong as it's not technically an array of efi_memory_desc_t's; they could be larger. Regardless, leave the type unchanged and remove the old style "0" array size. Additionally replace the open-coded entry offset code with the existing efi_memdesc_ptr() helper. Signed-off-by: Kees Cook <kees@kernel.org> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'include/linux/efi.h')
-rw-r--r--include/linux/efi.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 67b2fa80c8b9..6bf3c4fe8511 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -608,7 +608,11 @@ typedef struct {
u32 num_entries;
u32 desc_size;
u32 flags;
- efi_memory_desc_t entry[0];
+ /*
+ * There are @num_entries following, each of size @desc_size bytes,
+ * including an efi_memory_desc_t header. See efi_memdesc_ptr().
+ */
+ efi_memory_desc_t entry[];
} efi_memory_attributes_table_t;
typedef struct {