Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a477034750ce59df7fc17823f085df5a30e316f0
Commit:     a477034750ce59df7fc17823f085df5a30e316f0
Parent:     f02424785ab83bab8283ad33044284f749c08db8
Author:     Rusty Russell <[EMAIL PROTECTED]>
AuthorDate: Wed Aug 1 14:46:11 2007 +1000
Committer:  Avi Kivity <[EMAIL PROTECTED]>
CommitDate: Sat Oct 13 10:18:23 2007 +0200

    KVM: Use kmem_cache_free for kmem_cache_zalloc'ed objects
    
    We use kfree in svm.c and vmx.c, and this works, but it could break at
    any time.  kfree() is supposed to match up with kmalloc().
    
    Signed-off-by: Rusty Russell <[EMAIL PROTECTED]>
    Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>
---
 drivers/kvm/svm.c |    4 ++--
 drivers/kvm/vmx.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index 3ec30d7..436bdff 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -610,7 +610,7 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, 
unsigned int id)
 uninit:
        kvm_vcpu_uninit(&svm->vcpu);
 free_svm:
-       kfree(svm);
+       kmem_cache_free(kvm_vcpu_cache, svm);
 out:
        return ERR_PTR(err);
 }
@@ -621,7 +621,7 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu)
 
        __free_page(pfn_to_page(svm->vmcb_pa >> PAGE_SHIFT));
        kvm_vcpu_uninit(vcpu);
-       kfree(svm);
+       kmem_cache_free(kvm_vcpu_cache, svm);
 }
 
 static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c
index ae54d9a..708055a 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -2359,7 +2359,7 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
        kfree(vmx->host_msrs);
        kfree(vmx->guest_msrs);
        kvm_vcpu_uninit(vcpu);
-       kfree(vmx);
+       kmem_cache_free(kvm_vcpu_cache, vmx);
 }
 
 static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
@@ -2410,7 +2410,7 @@ free_guest_msrs:
 uninit_vcpu:
        kvm_vcpu_uninit(&vmx->vcpu);
 free_vcpu:
-       kfree(vmx);
+       kmem_cache_free(kvm_vcpu_cache, vmx);
        return ERR_PTR(err);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to