Skip to contentSkip to conversation

riscv: kdump: return early for invalid 'crashkernel=0' input

PATCH In review Austin Kim 2 participants 3 messages Feb 6 – Feb 13 RISC-V

lore
Share & tools
lore

Austin Kim

author
#0 lore raw

PATCH 1/1 riscv: kdump: return early for invalid 'crashkernel=0' input

From: Austin Kim <[email protected]>

An invalid 'crashkernel=0' can be specified when running kdump. By adding a check for 'crashkernel=0', it can return early when detecting this invalid input.

---
 arch/riscv/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/init.c +2 -1
index 811e03786..e61fec445 100644
@@ -1409,7 +1409,8 @@ static void __init arch_reserve_crashkernel(void)
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
 				&crash_size, &crash_base,
 				&low_size, NULL, &high);
-	if (ret)
+	/* invalid value specified or 'crashkernel=0' */
+	if (ret || !crash_size)
 		return;
 
 	reserve_crashkernel_generic(crash_size, crash_base, low_size, high);
Signature · 1 line
2.34.1
maintainer
#1 lore raw

Hi,

Quoted 16 lines · Austin Kim

From: Austin Kim <[email protected]>

An invalid 'crashkernel=0' can be specified when running kdump. By adding a check for 'crashkernel=0', it can return early when detecting this invalid input.

---
 arch/riscv/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/init.c +0 -0
index 811e03786..e61fec445 100644

arch/riscv/mm/init.c static void __init arch_reserve_crashkernel(void) · line 1416

Quoted 9 lines
arch/riscv/mm/init.c +2 -1
@@ -1409,7 +1409,8 @@ static void __init arch_reserve_crashkernel(void)
 	ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
 				&crash_size, &crash_base,
 				&low_size, NULL, &high);
-	if (ret)
+	/* invalid value specified or 'crashkernel=0' */
+	if (ret || !crash_size)
 		return;
 
 	reserve_crashkernel_generic(crash_size, crash_base, low_size, high);

Should this fix the common code in kernel/crash_reserve.c to return an error code when crashkernel=0 so it benefits other architectures?

- Paul

author
#2 lore raw

Hello Paul,

2026년 2월 13일 (금) AM 9:47, Paul Walmsley <[email protected]>님이 작성:

Quoted 29 lines

Hi,

Quoted 24 lines · Austin Kim

From: Austin Kim <[email protected]>

An invalid 'crashkernel=0' can be specified when running kdump. By adding a check for 'crashkernel=0', it can return early when detecting this invalid input.

---
 arch/riscv/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/init.c +2 -1
index 811e03786..e61fec445 100644
@@ -1409,7 +1409,8 @@ static void __init arch_reserve_crashkernel(void)
      ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(),
                              &crash_size, &crash_base,
                              &low_size, NULL, &high);
-     if (ret)
+     /* invalid value specified or 'crashkernel=0' */
+     if (ret || !crash_size)
              return;
 
Quoted 4 lines

arch/riscv/mm/init.c static void __init arch_reserve_crashkernel(void) · line 1416

Quoted 1 line
arch/riscv/mm/init.c +0 -0
      reserve_crashkernel_generic(crash_size, crash_base, low_size, high);

Should this fix the common code in kernel/crash_reserve.c to return an error code when crashkernel=0 so it benefits other architectures?

Thanks for another better idea.

I will find out the way to add exception handling for the "crashkernel=0" case in the generic APIs below.

kernel/crash_reserve.c
static int __init __parse_crashkernel(...)
static __init char *get_last_crashkernel(...)

As you said, it would be better if other architectures will benefit from this change.

BR,
Austin Kim

Quoted 3 lines

- Paul