提交 e0bf2665 编写于 作者: K KarimAllah Ahmed 提交者: Paolo Bonzini

KVM/nVMX: Use page_address_valid in a few more locations

Use page_address_valid in a few more locations that is already checking for
a page aligned address that does not cross the maximum physical address.
Signed-off-by: NKarimAllah Ahmed <karahmed@amazon.de>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 dee9c049
...@@ -4275,7 +4275,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu) ...@@ -4275,7 +4275,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
* Note - IA32_VMX_BASIC[48] will never be 1 for the nested case; * Note - IA32_VMX_BASIC[48] will never be 1 for the nested case;
* which replaces physical address width with 32 * which replaces physical address width with 32
*/ */
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) if (!page_address_valid(vcpu, vmptr))
return nested_vmx_failInvalid(vcpu); return nested_vmx_failInvalid(vcpu);
if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) || if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) ||
...@@ -4338,7 +4338,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu) ...@@ -4338,7 +4338,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
if (nested_vmx_get_vmptr(vcpu, &vmptr)) if (nested_vmx_get_vmptr(vcpu, &vmptr))
return 1; return 1;
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) if (!page_address_valid(vcpu, vmptr))
return nested_vmx_failValid(vcpu, return nested_vmx_failValid(vcpu,
VMXERR_VMCLEAR_INVALID_ADDRESS); VMXERR_VMCLEAR_INVALID_ADDRESS);
...@@ -4545,7 +4545,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) ...@@ -4545,7 +4545,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
if (nested_vmx_get_vmptr(vcpu, &vmptr)) if (nested_vmx_get_vmptr(vcpu, &vmptr))
return 1; return 1;
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu))) if (!page_address_valid(vcpu, vmptr))
return nested_vmx_failValid(vcpu, return nested_vmx_failValid(vcpu,
VMXERR_VMPTRLD_INVALID_ADDRESS); VMXERR_VMPTRLD_INVALID_ADDRESS);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册