Skip to content

Commit 13f6788

Browse files
Sean Christophersonbonzini
authored andcommitted
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: Christoffer Dall <christoffer.dall@arm.com> Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 13ea525 commit 13f6788

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

virt/kvm/kvm_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
10891089
new.userspace_addr = mem->userspace_addr;
10901090

10911091
if (kvm_arch_create_memslot(kvm, &new, npages))
1092-
goto out_free;
1092+
goto out;
10931093
}
10941094

10951095
/* Allocate page dirty bitmap if needed */

0 commit comments

Comments
 (0)