NOISSUE - Fix TDXEnabled function to check for 'Y' instead of '1' in kernel parameter (#467)

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

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

* Fix TDXEnabled test to check for 'Y' instead of '1' in CPU flags

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-27 12:43:07 +03:00
committed by GitHub
parent 31c7833c3d
commit f52702b631
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -209,7 +209,7 @@ func SEVSNPEnabled(cpuinfo, kernelParam string) bool {
}
func TDXEnabled(cpuinfo, kernelParam string) bool {
return strings.Contains(cpuinfo, "tdx_host_platform") && strings.TrimSpace(kernelParam) == "1"
return strings.Contains(cpuinfo, "tdx_host_platform") && strings.TrimSpace(kernelParam) == "Y"
}
// Checks if SEV is supported and usable by verifying both CPU flags and the /dev/sev device.
+1 -1
View File
@@ -192,7 +192,7 @@ func TestSEVSNPEnabled(t *testing.T) {
func TestTDXEnabled(t *testing.T) {
t.Run("cpuinfo and kvm param correct", func(t *testing.T) {
assert.True(t, TDXEnabled("flags: tdx_host_platform abc", "1"))
assert.True(t, TDXEnabled("flags: tdx_host_platform abc", "Y"))
})
t.Run("missing tdx_host_platform in cpuinfo", func(t *testing.T) {