Skip to content

Commit e0bf266

Browse files
KarimAllah Ahmedbonzini
authored andcommitted
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: KarimAllah Ahmed <karahmed@amazon.de> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent dee9c04 commit e0bf266

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/x86/kvm/vmx/nested.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,7 +4275,7 @@ static int handle_vmon(struct kvm_vcpu *vcpu)
42754275
* Note - IA32_VMX_BASIC[48] will never be 1 for the nested case;
42764276
* which replaces physical address width with 32
42774277
*/
4278-
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
4278+
if (!page_address_valid(vcpu, vmptr))
42794279
return nested_vmx_failInvalid(vcpu);
42804280

42814281
if (kvm_read_guest(vcpu->kvm, vmptr, &revision, sizeof(revision)) ||
@@ -4338,7 +4338,7 @@ static int handle_vmclear(struct kvm_vcpu *vcpu)
43384338
if (nested_vmx_get_vmptr(vcpu, &vmptr))
43394339
return 1;
43404340

4341-
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
4341+
if (!page_address_valid(vcpu, vmptr))
43424342
return nested_vmx_failValid(vcpu,
43434343
VMXERR_VMCLEAR_INVALID_ADDRESS);
43444344

@@ -4545,7 +4545,7 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
45454545
if (nested_vmx_get_vmptr(vcpu, &vmptr))
45464546
return 1;
45474547

4548-
if (!PAGE_ALIGNED(vmptr) || (vmptr >> cpuid_maxphyaddr(vcpu)))
4548+
if (!page_address_valid(vcpu, vmptr))
45494549
return nested_vmx_failValid(vcpu,
45504550
VMXERR_VMPTRLD_INVALID_ADDRESS);
45514551

0 commit comments

Comments
 (0)