Skip to contentSkip to conversation

correctly check gfn_to_pfn() return value

PATCH In review Gleb Natapov 2 participants 2 messages Jul 7, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 correctly check gfn_to_pfn() return value

On failure gfn_to_pfn returns bad_page so use correct function to check for that.

arch/powerpc/kvm/book3s_32_mmu_host.c +1 -1
index 0b51ef8..2e3a63d 100644
@@ -148,7 +148,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
 
 	/* Get host physical address for gpa */
 	hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT);
-	if (kvm_is_error_hva(hpaddr)) {
+	if (is_error_pfn(hpaddr)) {
 		printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n",
 				 orig_pte->eaddr);
 		return -EINVAL;
arch/powerpc/kvm/book3s_64_mmu_host.c +1 -1
index 384179a..1380f6e 100644
@@ -102,7 +102,7 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
 
 	/* Get host physical address for gpa */
 	hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT);
-	if (kvm_is_error_hva(hpaddr)) {
+	if (is_error_pfn(hpaddr)) {
 		printk(KERN_INFO "Couldn't get guest page for gfn %lx!\n", orig_pte->eaddr);
 		return -EINVAL;
 	}

--
Gleb.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 2 lines · Gleb Natapov

On failure gfn_to_pfn returns bad_page so use correct function to check for that.

Very good catch. I'll include it in my MMU patch set once I got it properly RCU'ified.

Alex