Re: [PATCH] efistub/x86: Use struct boot_e820_entry for size calculations
From: Ard Biesheuvel
Date: Thu Sep 10 2026 - 03:49:48 EST
On Sat, 29 Aug 2026, at 23:20, Thorsten Blum wrote:
> alloc_e820ext() and setup_e820() use sizeof(struct e820_entry) when
> calculating the sizes of boot_e820_entry structures.
>
> Even though struct e820_entry and struct boot_e820_entry have the same
> size, use sizeof(struct boot_e820_entry) for consistency instead.
>
> Signed-off-by: Thorsten Blum <blum@xxxxxxxxxx>
> ---
> drivers/firmware/efi/libstub/x86-stub.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Queued up in efi/next - thanks.
> diff --git a/drivers/firmware/efi/libstub/x86-stub.c
> b/drivers/firmware/efi/libstub/x86-stub.c
> index cef32e2c82d8..ae2481f8a4c3 100644
> --- a/drivers/firmware/efi/libstub/x86-stub.c
> +++ b/drivers/firmware/efi/libstub/x86-stub.c
> @@ -648,7 +648,7 @@ setup_e820(struct boot_params *params, struct
> setup_data *e820ext, u32 e820ext_s
> }
>
> if (nr_entries == ARRAY_SIZE(params->e820_table)) {
> - u32 need = (nr_desc - i) * sizeof(struct e820_entry) +
> + u32 need = (nr_desc - i) * sizeof(struct boot_e820_entry) +
> sizeof(struct setup_data);
>
> if (!e820ext || e820ext_size < need)
> @@ -684,7 +684,7 @@ static efi_status_t alloc_e820ext(u32 nr_desc,
> struct setup_data **e820ext,
> unsigned long size;
>
> size = sizeof(struct setup_data) +
> - sizeof(struct e820_entry) * nr_desc;
> + sizeof(struct boot_e820_entry) * nr_desc;
>
> if (*e820ext) {
> efi_bs_call(free_pool, *e820ext);