riscv: kdump: return early for invalid 'crashkernel=0' input
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
@@ -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
Paul Walmsley
maintainerHi,
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.
Signed-off-by Austin Kim <[email protected]>--- arch/riscv/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/riscv/mm/init.c +0
-0
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
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.
Signed-off-by Austin Kim <[email protected]>--- arch/riscv/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)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 ;
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
-0reserve_crashkernel_generic (crash_size, crash_base, low_size, high);Should this fix the common code in
kernel/crash_reserve.cto 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