mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/3] x86/setup: Fix logged allocation range in relocate_initrd()
@ 2026-08-26 18:10 Thorsten Blum
  2026-08-26 18:10 ` [PATCH 2/3] x86/setup: Simplify copy error handling " Thorsten Blum
  2026-08-26 18:10 ` [PATCH 3/3] x86/setup: Use pr_info() " Thorsten Blum
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-26 18:10 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Mike Rapoport (Microsoft),
	Ard Biesheuvel, Andrew Morton, Thomas Zimmermann, Breno Leitao,
	Thorsten Blum, Harshit Mogalapalli, Yinghai Lu, Johannes Weiner
  Cc: Thorsten Blum, Ingo Molnar, linux-kernel

Since commit c967da6a0ba8 ("x86: Make sure free_init_pages() frees pages
on page boundary"), relocate_initrd() allocates area_size bytes, which
is ramdisk_size rounded up to a page boundary. However, the log still
uses the potentially smaller ramdisk_size to calculate the end of the
allocated range and can report it as too short.

Use area_size instead.

Fixes: c967da6a0ba8 ("x86: Make sure free_init_pages() frees pages on page boundary")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index cda6adb9f69c..1fede9834835 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -334,7 +334,7 @@ static void __init relocate_initrd(void)
 	initrd_start = relocated_ramdisk + PAGE_OFFSET;
 	initrd_end   = initrd_start + ramdisk_size;
 	printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
-	       relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
+	       relocated_ramdisk, relocated_ramdisk + area_size - 1);
 
 	ret = copy_from_early_mem((void *)initrd_start, ramdisk_image, ramdisk_size);
 	if (ret)

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

* [PATCH 2/3] x86/setup: Simplify copy error handling in relocate_initrd()
  2026-08-26 18:10 [PATCH 1/3] x86/setup: Fix logged allocation range in relocate_initrd() Thorsten Blum
@ 2026-08-26 18:10 ` Thorsten Blum
  2026-08-26 18:10 ` [PATCH 3/3] x86/setup: Use pr_info() " Thorsten Blum
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-26 18:10 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Ard Biesheuvel, Mike Rapoport (Microsoft),
	Andrew Morton, Thomas Zimmermann, Pratyush Yadav (Google),
	Breno Leitao, Harshit Mogalapalli, Thorsten Blum
  Cc: Thorsten Blum, Ingo Molnar, linux-kernel

Check the result of copy_from_early_mem() directly and drop the
now-obsolete local ret variable.

No functional change.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/kernel/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1fede9834835..fa1a7c29285e 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -322,7 +322,6 @@ static void __init relocate_initrd(void)
 	u64 ramdisk_image = get_ramdisk_image();
 	u64 ramdisk_size  = get_ramdisk_size();
 	u64 area_size     = PAGE_ALIGN(ramdisk_size);
-	int ret = 0;
 
 	/* We need to move the initrd down into directly mapped mem */
 	u64 relocated_ramdisk = memblock_phys_alloc_range(area_size, PAGE_SIZE, 0,
@@ -336,8 +335,7 @@ static void __init relocate_initrd(void)
 	printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
 	       relocated_ramdisk, relocated_ramdisk + area_size - 1);
 
-	ret = copy_from_early_mem((void *)initrd_start, ramdisk_image, ramdisk_size);
-	if (ret)
+	if (copy_from_early_mem((void *)initrd_start, ramdisk_image, ramdisk_size))
 		panic("Copy RAMDISK failed\n");
 
 	printk(KERN_INFO "Move RAMDISK from [mem %#010llx-%#010llx] to"

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

* [PATCH 3/3] x86/setup: Use pr_info() in relocate_initrd()
  2026-08-26 18:10 [PATCH 1/3] x86/setup: Fix logged allocation range in relocate_initrd() Thorsten Blum
  2026-08-26 18:10 ` [PATCH 2/3] x86/setup: Simplify copy error handling " Thorsten Blum
@ 2026-08-26 18:10 ` Thorsten Blum
  1 sibling, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-26 18:10 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Ard Biesheuvel, Mike Rapoport (Microsoft),
	Andrew Morton, Thomas Zimmermann, Harshit Mogalapalli,
	Breno Leitao, Thorsten Blum
  Cc: Thorsten Blum, Ingo Molnar, Arnd Bergmann, linux-kernel

Use pr_info() instead of printk(KERN_INFO) as suggested by checkpatch.

Also change "Move" to "Moved" to match the past tense of "Allocated".

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/kernel/setup.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index fa1a7c29285e..d78fef974f56 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -332,14 +332,13 @@ static void __init relocate_initrd(void)
 
 	initrd_start = relocated_ramdisk + PAGE_OFFSET;
 	initrd_end   = initrd_start + ramdisk_size;
-	printk(KERN_INFO "Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
-	       relocated_ramdisk, relocated_ramdisk + area_size - 1);
+	pr_info("Allocated new RAMDISK: [mem %#010llx-%#010llx]\n",
+		relocated_ramdisk, relocated_ramdisk + area_size - 1);
 
 	if (copy_from_early_mem((void *)initrd_start, ramdisk_image, ramdisk_size))
 		panic("Copy RAMDISK failed\n");
 
-	printk(KERN_INFO "Move RAMDISK from [mem %#010llx-%#010llx] to"
-		" [mem %#010llx-%#010llx]\n",
+	pr_info("Moved RAMDISK from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n",
 		ramdisk_image, ramdisk_image + ramdisk_size - 1,
 		relocated_ramdisk, relocated_ramdisk + ramdisk_size - 1);
 }

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

end of thread, other threads:[~2026-08-26 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-26 18:10 [PATCH 1/3] x86/setup: Fix logged allocation range in relocate_initrd() Thorsten Blum
2026-08-26 18:10 ` [PATCH 2/3] x86/setup: Simplify copy error handling " Thorsten Blum
2026-08-26 18:10 ` [PATCH 3/3] x86/setup: Use pr_info() " Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®