From: Wei Yongjun <yjwei@cn.fujitsu.com>
To: kvm@vger.kernel.org, Avi Kivity <avi@redhat.com>
Subject: [PATCH] KVM: MMU: Remove some useless code from alloc_mmu_pages()
Date: Fri, 22 Jan 2010 16:55:05 +0800 [thread overview]
Message-ID: <4B5967E9.6060807@cn.fujitsu.com> (raw)
In-Reply-To: <4B594347.2010904@cn.fujitsu.com>
If we fail to alloc page for vcpu->arch.mmu.pae_root, call to
free_mmu_pages() is unnecessary, which just do free the page
malloc for vcpu->arch.mmu.pae_root.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
---
arch/x86/kvm/mmu.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 4c3e5b2..5d8e01b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2849,16 +2849,13 @@ static int alloc_mmu_pages(struct kvm_vcpu *vcpu)
*/
page = alloc_page(GFP_KERNEL | __GFP_DMA32);
if (!page)
- goto error_1;
+ return -ENOMEM;
+
vcpu->arch.mmu.pae_root = page_address(page);
for (i = 0; i < 4; ++i)
vcpu->arch.mmu.pae_root[i] = INVALID_PAGE;
return 0;
-
-error_1:
- free_mmu_pages(vcpu);
- return -ENOMEM;
}
int kvm_mmu_create(struct kvm_vcpu *vcpu)
--
1.6.2.2
next prev parent reply other threads:[~2010-01-22 8:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-22 6:18 [PATCH 1/2] KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks Wei Yongjun
2010-01-22 6:21 ` [PATCH 2/2] KVM: x86: Fix leak of free lapic date in kvm_arch_vcpu_init() Wei Yongjun
2010-01-22 6:41 ` [PATCH 1/2 v2] KVM: x86: Fix probable memory leak of vcpu->arch.mce_banks Wei Yongjun
2010-01-22 8:55 ` Wei Yongjun [this message]
2010-01-23 19:23 ` [PATCH] KVM: MMU: Remove some useless code from alloc_mmu_pages() Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B5967E9.6060807@cn.fujitsu.com \
--to=yjwei@cn.fujitsu.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox