Commit 13f67889 authored by Sean Christopherson's avatar Sean Christopherson Committed by Paolo Bonzini

KVM: Don't free new memslot if allocation of said memslot fails

The two implementations of kvm_arch_create_memslot() in x86 and PPC are
both good citizens and free up all local resources if creation fails.
Return immediately (via a superfluous goto) instead of calling
kvm_free_memslot().

Note, the call to kvm_free_memslot() is effectively an expensive nop in
this case as there are no resources to be freed.

No functional change intended.
Acked-by: default avatarChristoffer Dall <christoffer.dall@arm.com>
Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
Signed-off-by: default avatarSean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 13ea5255
......@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
new.userspace_addr = mem->userspace_addr;
if (kvm_arch_create_memslot(kvm, &new, npages))
goto out_free;
goto out;
}
/* Allocate page dirty bitmap if needed */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment