All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efistub/x86: Use struct boot_e820_entry for size calculations
@ 2026-08-29 21:20 Thorsten Blum
  2026-09-10  7:43 ` Ard Biesheuvel
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-08-29 21:20 UTC (permalink / raw)
  To: Ard Biesheuvel, Ilias Apalodimas, Javier Martinez Canillas,
	Thomas Zimmermann, Lenny Szubowicz, Borislav Petkov (AMD),
	Francesco Pompo
  Cc: Thorsten Blum, linux-efi, linux-kernel

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@kernel.org>
---
 drivers/firmware/efi/libstub/x86-stub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] efistub/x86: Use struct boot_e820_entry for size calculations
  2026-08-29 21:20 [PATCH] efistub/x86: Use struct boot_e820_entry for size calculations Thorsten Blum
@ 2026-09-10  7:43 ` Ard Biesheuvel
  0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2026-09-10  7:43 UTC (permalink / raw)
  To: Thorsten Blum, Ilias Apalodimas, Javier Martinez Canillas,
	Thomas Zimmermann, Lenny Szubowicz, Borislav Petkov,
	Francesco Pompo
  Cc: linux-efi, linux-kernel



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@kernel.org>
> ---
>  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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-10  7:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-29 21:20 [PATCH] efistub/x86: Use struct boot_e820_entry for size calculations Thorsten Blum
2026-09-10  7:43 ` Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.