Commit 0ea75e1d authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Gleb Natapov

KVM: set_memory_region: Don't jump to out_free unnecessarily

This makes the separation between the sanity checks and the rest of the
code a bit clearer.
Reviewed-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: default avatarGleb Natapov <gleb@redhat.com>
parent a046b816
...@@ -778,9 +778,9 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -778,9 +778,9 @@ int __kvm_set_memory_region(struct kvm *kvm,
*/ */
r = -EINVAL; r = -EINVAL;
if (npages && old.npages && npages != old.npages) if (npages && old.npages && npages != old.npages)
goto out_free; goto out;
if (!npages && !old.npages) if (!npages && !old.npages)
goto out_free; goto out;
/* Check for overlaps */ /* Check for overlaps */
r = -EEXIST; r = -EEXIST;
...@@ -789,7 +789,7 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -789,7 +789,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
continue; continue;
if (!((base_gfn + npages <= slot->base_gfn) || if (!((base_gfn + npages <= slot->base_gfn) ||
(base_gfn >= slot->base_gfn + slot->npages))) (base_gfn >= slot->base_gfn + slot->npages)))
goto out_free; goto out;
} }
/* Free page dirty bitmap if unneeded */ /* Free page dirty bitmap if unneeded */
...@@ -890,7 +890,6 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -890,7 +890,6 @@ int __kvm_set_memory_region(struct kvm *kvm,
kvm_free_physmem_slot(&new, &old); kvm_free_physmem_slot(&new, &old);
out: out:
return r; return r;
} }
EXPORT_SYMBOL_GPL(__kvm_set_memory_region); EXPORT_SYMBOL_GPL(__kvm_set_memory_region);
......
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