linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: PPC: Book3S PR: return appropriate error when allocation fails
@ 2013-07-17 15:10 Thadeu Lima de Souza Cascardo
  2013-08-28 14:26 ` Alexander Graf
  0 siblings, 1 reply; 2+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2013-07-17 15:10 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: kvm, Gleb Natapov, Alexander Graf, kvm-ppc, linux-kernel,
	Paul Mackerras, Thadeu Lima de Souza Cascardo, Paolo Bonzini

err was overwritten by a previous function call, and checked to be 0. If
the following page allocation fails, 0 is going to be returned instead
of -ENOMEM.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
---
 arch/powerpc/kvm/book3s_pr.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
index 19498a5..c6e13d9 100644
--- a/arch/powerpc/kvm/book3s_pr.c
+++ b/arch/powerpc/kvm/book3s_pr.c
@@ -1047,11 +1047,12 @@ struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
 	if (err)
 		goto free_shadow_vcpu;
 
+	err = -ENOMEM;
 	p = __get_free_page(GFP_KERNEL|__GFP_ZERO);
-	/* the real shared page fills the last 4k of our page */
-	vcpu->arch.shared = (void*)(p + PAGE_SIZE - 4096);
 	if (!p)
 		goto uninit_vcpu;
+	/* the real shared page fills the last 4k of our page */
+	vcpu->arch.shared = (void *)(p + PAGE_SIZE - 4096);
 
 #ifdef CONFIG_PPC_BOOK3S_64
 	/* default to book3s_64 (970fx) */
-- 
1.7.1

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

* Re: [PATCH] KVM: PPC: Book3S PR: return appropriate error when allocation fails
  2013-07-17 15:10 [PATCH] KVM: PPC: Book3S PR: return appropriate error when allocation fails Thadeu Lima de Souza Cascardo
@ 2013-08-28 14:26 ` Alexander Graf
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Graf @ 2013-08-28 14:26 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo
  Cc: Gleb Natapov, kvm, linux-kernel, kvm-ppc, Paul Mackerras,
	Paolo Bonzini, linuxppc-dev


On 17.07.2013, at 17:10, Thadeu Lima de Souza Cascardo wrote:

> err was overwritten by a previous function call, and checked to be 0. If
> the following page allocation fails, 0 is going to be returned instead
> of -ENOMEM.
> 
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>

Thanks, applied to kvm-ppc-queue.


Alex

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

end of thread, other threads:[~2013-08-28 14:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-17 15:10 [PATCH] KVM: PPC: Book3S PR: return appropriate error when allocation fails Thadeu Lima de Souza Cascardo
2013-08-28 14:26 ` Alexander Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).