From 3679776f3cc50c6160d08750f797059b18d835b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Sun, 20 Mar 2022 00:55:49 +0100 Subject: [PATCH] chore: only attempt to load msr and cpuid module once --- spectre-meltdown-checker.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spectre-meltdown-checker.sh b/spectre-meltdown-checker.sh index 8f31107..2324e2c 100755 --- a/spectre-meltdown-checker.sh +++ b/spectre-meltdown-checker.sh @@ -1413,6 +1413,10 @@ mount_debugfs() load_msr() { + # only attempt to do it once even if called multiple times + [ "$load_msr_once" = 1 ] && return + load_msr_once=1 + if [ "$os" = Linux ]; then if ! grep -qw msr "$procfs/modules" 2>/dev/null; then modprobe msr 2>/dev/null && insmod_msr=1 @@ -1432,6 +1436,10 @@ load_msr() load_cpuid() { + # only attempt to do it once even if called multiple times + [ "$load_cpuid_once" = 1 ] && return + load_cpuid_once=1 + if [ "$os" = Linux ]; then if ! grep -qw cpuid "$procfs/modules" 2>/dev/null; then modprobe cpuid 2>/dev/null && insmod_cpuid=1