linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl
@ 2017-03-17 20:41 Dan Carpenter
  2017-03-20  4:20 ` David Gibson
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-17 20:41 UTC (permalink / raw)
  To: Paolo Bonzini, David Gibson
  Cc: Radim Krčmář, Alexander Graf,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, kvm,
	kvm-ppc, linuxppc-dev, kernel-janitors

kzalloc() won't actually fail because sizeof(*resize) is small, but
static checkers complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 8c68145ba1bd..710e491206ed 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -1487,6 +1487,10 @@ long kvm_vm_ioctl_resize_hpt_prepare(struct kvm *kvm,
 	/* start new resize */
 
 	resize = kzalloc(sizeof(*resize), GFP_KERNEL);
+	if (!resize) {
+		ret = -ENOMEM;
+		goto out;
+	}
 	resize->order = shift;
 	resize->kvm = kvm;
 	INIT_WORK(&resize->work, resize_hpt_prepare_work);

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

end of thread, other threads:[~2017-03-20  5:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-17 20:41 [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl Dan Carpenter
2017-03-20  4:20 ` 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).