linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH kernel] KVM: PPC: Check kzalloc() return
@ 2017-03-27  3:19 Alexey Kardashevskiy
  2017-03-27  4:25 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Kardashevskiy @ 2017-03-27  3:19 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Alexey Kardashevskiy, David Gibson, Alex Williamson, kvm-ppc, kvm,
	Paul Mackerras

This adds missing check for failed kzalloc().

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---

This is a followup change for:
[PATCH kernel v11 10/10] KVM: PPC: VFIO: Add in-kernel acceleration for VFIO

Please squash it. Thanks!
---
 arch/powerpc/kvm/book3s_64_vio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
index 22c67a47eaab..c3d8a88f1f4e 100644
--- a/arch/powerpc/kvm/book3s_64_vio.c
+++ b/arch/powerpc/kvm/book3s_64_vio.c
@@ -212,6 +212,11 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
 	}
 
 	stit = kzalloc(sizeof(*stit), GFP_KERNEL);
+	if (!stit) {
+		iommu_tce_table_put(tbl);
+		return -ENOMEM;
+	}
+
 	stit->tbl = tbl;
 	kref_init(&stit->kref);
 
-- 
2.11.0

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

end of thread, other threads:[~2017-03-27  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-27  3:19 [PATCH kernel] KVM: PPC: Check kzalloc() return Alexey Kardashevskiy
2017-03-27  4:25 ` David Gibson

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).