NOISSUE - Fix SEVSNPEnabled function to check for 'Y' instead of '1' in kernel parameter (#461)
CI / ci (push) Has been cancelled

* Fix SEVSNPEnabled function to check for 'Y' instead of '1' in kernel parameter

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* Fix TestSEVSNPEnabled to check for 'Y' instead of '1' in KVM parameter

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

---------

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
This commit is contained in:
Sammy Kerata Oina
2025-06-23 17:33:17 +03:00
committed by GitHub
parent bd59a4a617
commit 64bf7a56ac
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -205,7 +205,7 @@ func SEVEnabled(cpuinfo string, sevPresent bool) bool {
}
func SEVSNPEnabled(cpuinfo, kernelParam string) bool {
return strings.Contains(cpuinfo, "sev_snp") && strings.TrimSpace(kernelParam) == "1"
return strings.Contains(cpuinfo, "sev_snp") && strings.TrimSpace(kernelParam) == "Y"
}
func TDXEnabled(cpuinfo, kernelParam string) bool {
+1 -1
View File
@@ -178,7 +178,7 @@ func TestSEVEnabled(t *testing.T) {
func TestSEVSNPEnabled(t *testing.T) {
t.Run("cpuinfo and kvm param correct", func(t *testing.T) {
assert.True(t, SEVSNPEnabled("flags: sev_snp abc", "1"))
assert.True(t, SEVSNPEnabled("flags: sev_snp abc", "Y"))
})
t.Run("missing sev_snp in cpuinfo", func(t *testing.T) {