From ca306cd403bf666a6703a59be4a3ce36406f6659 Mon Sep 17 00:00:00 2001 From: Philipp Rudo Date: Mon, 3 Apr 2023 16:54:57 +0200 Subject: [PATCH] kdump-lib-initramfs: harden is_mounted If the device/mountpoint for findmnt is omitted findmnt will list all mounted filesystems. In that case it will always return "true". So explicitly check if an argument was passed to prevent false-positives. Signed-off-by: Philipp Rudo Reviewed-by: Coiby Xu --- kdump-lib-initramfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index a625634..c6338c6 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -30,7 +30,7 @@ kdump_get_conf_val() is_mounted() { - findmnt -k -n "$1" > /dev/null 2>&1 + [ -n "$1" ] && findmnt -k -n "$1" > /dev/null 2>&1 } # $1: info type