Prevent the --fadump option to be used on non-PPC systems. This not only
prevents user errors but also guarantees that _dump_mode and _fadump_val are
empty on these systems.
Signed-off-by: Philipp Rudo <prudo(a)redhat.com>
Reviewed-by: Pingfan Liu <piliu(a)redhat.com>
---
kdumpctl | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/kdumpctl b/kdumpctl
index 5088c32..113d8bc 100755
--- a/kdumpctl
+++ b/kdumpctl
@@ -1551,6 +1551,10 @@ reset_crashkernel()
for _opt in "$@"; do
case "$_opt" in
--fadump=*)
+ if [[ $(uname -m) != ppc64le ]]; then
+ derror "Option --fadump only valid on PPC"
+ exit 1
+ fi
_val=${_opt#*=}
if _dump_mode=$(get_dump_mode_by_fadump_val $_val); then
_fadump_val=$_val
@@ -1592,12 +1596,7 @@ reset_crashkernel()
return
fi
- # For non-ppc64le systems, the dump mode is always kdump since only ppc64le
- # has FADump.
- if [[ -z $_dump_mode && $(uname -m) != ppc64le ]]; then
- _dump_mode=kdump
- _fadump_val=off
- fi
+ [[ $(uname -m) != ppc64le ]] && _dump_mode=kdump
# If the dump mode is determined, we can also know the default crashkernel value
if [[ -n $_dump_mode ]]; then
--
2.41.0