Skip to contentSkip to conversation

KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()

PATCH Applied Takuya Yoshikawa 2 participants 2 messages Jun 19, 2012

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

PATCH 1/1 KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()

From: Takuya Yoshikawa <[email protected]>

The following commit did not care about the error handling path:

commit c1a7b32a14138f908df52d7c53b5ce3415ec6b50
KVM: Avoid wasting pages for small lpage_info arrays

If memory allocation fails, vfree() will be called with the address returned by kzalloc(). This patch fixes this issue.

---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kvm/x86.c +1 -1
index a01a424..6ed5983 100644
@@ -6350,7 +6350,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
 
 out_free:
 	for (i = 0; i < KVM_NR_PAGE_SIZES - 1; ++i) {
-		vfree(slot->arch.lpage_info[i]);
+		kvm_kvfree(slot->arch.lpage_info[i]);
 		slot->arch.lpage_info[i] = NULL;
 	}
 	return -ENOMEM;
Signature · 1 line
1.7.5.4
Applied
#1 lore raw
Quoted 9 lines · Takuya Yoshikawa

From: Takuya Yoshikawa <[email protected]>

The following commit did not care about the error handling path:

commit c1a7b32a14138f908df52d7c53b5ce3415ec6b50
KVM: Avoid wasting pages for small lpage_info arrays

If memory allocation fails, vfree() will be called with the address returned by kzalloc(). This patch fixes this issue.

Thanks, applied to next.

Signature · 1 line
error compiling committee.c: too many arguments to function