From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 1/2] KVM: nVMX: Validate EFER values for VM_ENTRY/EXIT_LOAD_IA32_EFER Date: Mon, 15 Apr 2013 13:08:50 +0200 Message-ID: <516BDFC2.3020107@redhat.com> References: <516A8879.6050202@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , Marcelo Tosatti , kvm , "Nadav Har'El" To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33950 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753884Ab3DOLJJ (ORCPT ); Mon, 15 Apr 2013 07:09:09 -0400 In-Reply-To: <516A8879.6050202@web.de> Sender: kvm-owner@vger.kernel.org List-ID: Il 14/04/2013 12:44, Jan Kiszka ha scritto: > + if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER && > + (!kvm_valid_efer(vcpu, vmcs12->guest_ia32_efer) || > + !!(vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) != > + !!(vmcs12->guest_ia32_efer & EFER_LMA) || > + (vmcs12->guest_cr0 & X86_CR0_PG && > + !!(vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) != > + !!(vmcs12->guest_ia32_efer & EFER_LME)))) { > + nested_vmx_entry_failure(vcpu, vmcs12, > + EXIT_REASON_INVALID_STATE, ENTRY_FAIL_DEFAULT); > + return 1; > + } if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER) { bool ia32e = (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) != 0; if (...) { } } Also please put parentheses around the & operator. The exit tests can similarly extract the host address space size bit to a bool. Paolo