1
0
mirror of https://github.com/speed47/spectre-meltdown-checker synced 2024-12-22 20:33:56 +01:00

fix: mocking value for read_msr

we were returning the mocking value before actually setting it.
also remove spaces around the returned value (no behavior change)
This commit is contained in:
Stéphane Lesimple 2019-09-21 18:50:08 +02:00
parent 0518604fe6
commit cc224c0522

View File

@ -2071,8 +2071,6 @@ read_msr()
_debug "read_msr: MOCKING enabled for msr $_msr, returning $read_msr_value" _debug "read_msr: MOCKING enabled for msr $_msr, returning $read_msr_value"
mocked=1 mocked=1
return 0 return 0
else
mockme=$(printf "%b\n%b" "$mockme" "SMC_MOCK_RDMSR_${_msr}='$read_msr_value'")
fi fi
_mockvarname="SMC_MOCK_RDMSR_${_msr}_RET" _mockvarname="SMC_MOCK_RDMSR_${_msr}_RET"
@ -2121,7 +2119,10 @@ read_msr()
mockme=$(printf "%b\n%b" "$mockme" "SMC_MOCK_RDMSR_${_msr}_RET=1") mockme=$(printf "%b\n%b" "$mockme" "SMC_MOCK_RDMSR_${_msr}_RET=1")
return 1 return 1
fi fi
# remove sparse spaces od might give us
read_msr_value=$(( read_msr_value ))
fi fi
mockme=$(printf "%b\n%b" "$mockme" "SMC_MOCK_RDMSR_${_msr}='$read_msr_value'")
_debug "read_msr: MSR=$_msr value is $read_msr_value" _debug "read_msr: MSR=$_msr value is $read_msr_value"
return 0 return 0
} }