All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] efi/libstub: Simplify check_image_region()
@ 2026-08-30 10:29 Thorsten Blum
  2026-08-30 10:29 ` [PATCH 2/2] efi/libstub: Fix grammar in efi_kaslr_relocate_kernel() comment Thorsten Blum
  2026-09-10  7:51 ` [PATCH 1/2] efi/libstub: Simplify check_image_region() Ard Biesheuvel
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-30 10:29 UTC (permalink / raw)
  To: Ard Biesheuvel, Ilias Apalodimas; +Cc: Thorsten Blum, linux-efi, linux-kernel

Drop the local ret variable and the break statement by returning the
result directly. Also use unsigned long for map_offset, since map_size
and desc_size are both unsigned long.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/firmware/efi/libstub/kaslr.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/firmware/efi/libstub/kaslr.c b/drivers/firmware/efi/libstub/kaslr.c
index 4bc963e999eb..17549bf3dc3e 100644
--- a/drivers/firmware/efi/libstub/kaslr.c
+++ b/drivers/firmware/efi/libstub/kaslr.c
@@ -59,8 +59,7 @@ static bool check_image_region(u64 base, u64 size)
 {
 	struct efi_boot_memmap *map __free(efi_pool) = NULL;
 	efi_status_t status;
-	bool ret = false;
-	int map_offset;
+	unsigned long map_offset;
 
 	status = efi_get_memory_map(&map, false);
 	if (status != EFI_SUCCESS)
@@ -74,13 +73,11 @@ static bool check_image_region(u64 base, u64 size)
 		 * Find the region that covers base, and return whether
 		 * it covers base+size bytes.
 		 */
-		if (base >= md->phys_addr && base < end) {
-			ret = (base + size) <= end;
-			break;
-		}
+		if (base >= md->phys_addr && base < end)
+			return (base + size) <= end;
 	}
 
-	return ret;
+	return false;
 }
 
 /**

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

* [PATCH 2/2] efi/libstub: Fix grammar in efi_kaslr_relocate_kernel() comment
  2026-08-30 10:29 [PATCH 1/2] efi/libstub: Simplify check_image_region() Thorsten Blum
@ 2026-08-30 10:29 ` Thorsten Blum
  2026-09-10  7:51 ` [PATCH 1/2] efi/libstub: Simplify check_image_region() Ard Biesheuvel
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-30 10:29 UTC (permalink / raw)
  To: Ard Biesheuvel, Ilias Apalodimas; +Cc: Thorsten Blum, linux-efi, linux-kernel

Fix the grammar in the kernel-doc comment and indent the @image_addr
description correctly.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 drivers/firmware/efi/libstub/kaslr.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/efi/libstub/kaslr.c b/drivers/firmware/efi/libstub/kaslr.c
index 17549bf3dc3e..b26227aa2c7b 100644
--- a/drivers/firmware/efi/libstub/kaslr.c
+++ b/drivers/firmware/efi/libstub/kaslr.c
@@ -82,7 +82,7 @@ static bool check_image_region(u64 base, u64 size)
 
 /**
  * efi_kaslr_relocate_kernel() - Relocate the kernel (random if KASLR enabled)
- * @image_addr: Pointer to the current kernel location
+ * @image_addr:		Pointer to the current kernel location
  * @reserve_addr:	Pointer to the relocated kernel location
  * @reserve_size:	Size of the relocated kernel
  * @kernel_size:	Size of the text + data
@@ -91,8 +91,8 @@ static bool check_image_region(u64 base, u64 size)
  * @phys_seed:		Random seed used for the relocation
  *
  * If KASLR is not enabled, this function relocates the kernel to a fixed
- * address (or leave it as its current location). If KASLR is enabled, the
- * kernel physical location is randomized using the seed in parameter.
+ * address or leaves it at its current location. If KASLR is enabled, the
+ * kernel's physical location is randomized using the supplied seed.
  *
  * Return:	status code, EFI_SUCCESS if relocation is successful
  */

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

* Re: [PATCH 1/2] efi/libstub: Simplify check_image_region()
  2026-08-30 10:29 [PATCH 1/2] efi/libstub: Simplify check_image_region() Thorsten Blum
  2026-08-30 10:29 ` [PATCH 2/2] efi/libstub: Fix grammar in efi_kaslr_relocate_kernel() comment Thorsten Blum
@ 2026-09-10  7:51 ` Ard Biesheuvel
  1 sibling, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2026-09-10  7:51 UTC (permalink / raw)
  To: Thorsten Blum, Ilias Apalodimas; +Cc: linux-efi, linux-kernel



On Sun, 30 Aug 2026, at 12:29, Thorsten Blum wrote:
> Drop the local ret variable and the break statement by returning the
> result directly. Also use unsigned long for map_offset, since map_size
> and desc_size are both unsigned long.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
>  drivers/firmware/efi/libstub/kaslr.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
>

Both patches applied to efi/next - thanks.

> diff --git a/drivers/firmware/efi/libstub/kaslr.c 
> b/drivers/firmware/efi/libstub/kaslr.c
> index 4bc963e999eb..17549bf3dc3e 100644
> --- a/drivers/firmware/efi/libstub/kaslr.c
> +++ b/drivers/firmware/efi/libstub/kaslr.c
> @@ -59,8 +59,7 @@ static bool check_image_region(u64 base, u64 size)
>  {
>  	struct efi_boot_memmap *map __free(efi_pool) = NULL;
>  	efi_status_t status;
> -	bool ret = false;
> -	int map_offset;
> +	unsigned long map_offset;
> 
>  	status = efi_get_memory_map(&map, false);
>  	if (status != EFI_SUCCESS)
> @@ -74,13 +73,11 @@ static bool check_image_region(u64 base, u64 size)
>  		 * Find the region that covers base, and return whether
>  		 * it covers base+size bytes.
>  		 */
> -		if (base >= md->phys_addr && base < end) {
> -			ret = (base + size) <= end;
> -			break;
> -		}
> +		if (base >= md->phys_addr && base < end)
> +			return (base + size) <= end;
>  	}
> 
> -	return ret;
> +	return false;
>  }
> 
>  /**

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-30 10:29 [PATCH 1/2] efi/libstub: Simplify check_image_region() Thorsten Blum
2026-08-30 10:29 ` [PATCH 2/2] efi/libstub: Fix grammar in efi_kaslr_relocate_kernel() comment Thorsten Blum
2026-09-10  7:51 ` [PATCH 1/2] efi/libstub: Simplify check_image_region() 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.