Suggested-by: George Dunlap <george.dun...@citrix.com>
Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1296,10 +1296,10 @@ in_longmode(
 {
     uint64_t efer;
 
-    if (ops->read_msr == NULL)
+    if ( !ops->read_msr ||
+         unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
         return -1;
 
-    ops->read_msr(MSR_EFER, &efer, ctxt);
     return !!(efer & EFER_LMA);
 }
 



x86emul: in_longmode() should not ignore ->read_msr() errors

Suggested-by: George Dunlap <george.dun...@citrix.com>
Signed-off-by: Jan Beulich <jbeul...@suse.com>

--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -1296,10 +1296,10 @@ in_longmode(
 {
     uint64_t efer;
 
-    if (ops->read_msr == NULL)
+    if ( !ops->read_msr ||
+         unlikely(ops->read_msr(MSR_EFER, &efer, ctxt) != X86EMUL_OKAY) )
         return -1;
 
-    ops->read_msr(MSR_EFER, &efer, ctxt);
     return !!(efer & EFER_LMA);
 }
 
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to