diff options
author | Kees Cook <kees@kernel.org> | 2024-07-11 10:11:13 -0700 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2024-07-12 10:06:01 +0200 |
commit | 4a2ebb082297f41803742729642961532e54079e (patch) | |
tree | 518aa4fa1429af07a0db955b75234a0fdefaf838 /drivers/firmware/efi | |
parent | 887c4cf5594a073fd60c0df84150eb06d78c6406 (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 'drivers/firmware/efi')
-rw-r--r-- | drivers/firmware/efi/memattr.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/memattr.c b/drivers/firmware/efi/memattr.c index ab85bf8e165a..164203429fa7 100644 --- a/drivers/firmware/efi/memattr.c +++ b/drivers/firmware/efi/memattr.c @@ -164,7 +164,7 @@ int __init efi_memattr_apply_permissions(struct mm_struct *mm, bool valid; char buf[64]; - valid = entry_is_valid((void *)tbl->entry + i * tbl->desc_size, + valid = entry_is_valid(efi_memdesc_ptr(tbl->entry, tbl->desc_size, i), &md); size = md.num_pages << EFI_PAGE_SHIFT; if (efi_enabled(EFI_DBG) || !valid) |