[PATCH] cpu: virt: correctly return true if SVM is enabled

Colin King colin.king at canonical.com
Tue May 7 08:52:36 UTC 2013


From: Colin Ian King <colin.king at canonical.com>

Coverity CID #997308: Operands don't affect result

The test for the SVM bit should be checking to see if the result
of the mask is set and returning 1 if so.  This is a bug inherited
from the Linux ready firmware kit.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/cpu/virt/virt_svm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cpu/virt/virt_svm.c b/src/cpu/virt/virt_svm.c
index ceba8b6..9b618fd 100644
--- a/src/cpu/virt/virt_svm.c
+++ b/src/cpu/virt/virt_svm.c
@@ -61,7 +61,7 @@ static int vt_locked_by_bios(void)
 	if (fwts_cpu_readmsr(0, MSR_FEATURE_CONTROL, &msr))
 		return -1;
 
-	return ((msr & 0x1000) == 1); /* SVM capable but locked by bios*/
+	return ((msr & 0x1000) == 0x1000); /* SVM capable but locked by bios*/
 }
 
 void virt_check_svm(fwts_framework *fw)
-- 
1.8.1.2




More information about the fwts-devel mailing list