All of lore.kernel.org
 help / color / mirror / Atom feed
* [FIX PATCH] KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()
@ 2012-06-19 13:04 Takuya Yoshikawa
  2012-06-19 13:10 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Takuya Yoshikawa @ 2012-06-19 13:04 UTC (permalink / raw)
  To: avi, mtosatti; +Cc: kvm, yoshikawa.takuya

From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>

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.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
---
 arch/x86/kvm/x86.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a01a424..6ed5983 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -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;
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [FIX PATCH] KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc()
  2012-06-19 13:04 [FIX PATCH] KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc() Takuya Yoshikawa
@ 2012-06-19 13:10 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2012-06-19 13:10 UTC (permalink / raw)
  To: Takuya Yoshikawa; +Cc: mtosatti, kvm, yoshikawa.takuya

On 06/19/2012 04:04 PM, Takuya Yoshikawa wrote:
> From: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
> 
> 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.


-- 
error compiling committee.c: too many arguments to function



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-06-19 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-19 13:04 [FIX PATCH] KVM: Use kvm_kvfree() to free memory allocated by kvm_kvzalloc() Takuya Yoshikawa
2012-06-19 13:10 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.