Skip to content

Commit e94ec34

Browse files
licliucoiby
authored andcommitted
kdumpctl: check the return value of get_dump_mode_by_kernel
We should check the return value of get_dump_mode_by_kernel and exit if there is an error. Signed-off-by: Lichen Liu <[email protected]>
1 parent 6c9a8c2 commit e94ec34

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kdumpctl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,9 @@ reset_crashkernel()
16871687
fi
16881688
fi
16891689
else
1690-
_dump_mode="$(get_dump_mode_by_kernel "$_kernel")"
1690+
if ! _dump_mode="$(get_dump_mode_by_kernel "$_kernel")"; then
1691+
exit 1
1692+
fi
16911693
_new_ck=$(kdump_get_arch_recommend_crashkernel "$_dump_mode")
16921694
fi
16931695
else
@@ -1726,7 +1728,9 @@ _update_crashkernel()
17261728
local _old_ck _new_ck
17271729

17281730
_kernel=$1
1729-
_dump_mode=$(get_dump_mode_by_kernel "$_kernel")
1731+
if ! _dump_mode=$(get_dump_mode_by_kernel "$_kernel"); then
1732+
exit 1
1733+
fi
17301734
_old_ck=$(get_grub_kernel_boot_parameter "$_kernel" crashkernel)
17311735
_kver=$(parse_kver_from_path "$_kernel")
17321736
# The second argument is for the case of aarch64, where installing a 64k variant on a 4k kernel, or vice versa

0 commit comments

Comments
 (0)