From: Dan Carpenter Date: Fri, 17 Mar 2017 20:41:14 +0000 (+0300) Subject: KVM: PPC: Book3S HV: Check for kmalloc errors in ioctl X-Git-Tag: MMI-PSA29.97-13-9~5856^2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=abd80dcbc400fac878202136645e9acf0e0bfbd9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git KVM: PPC: Book3S HV: Check for kmalloc errors in ioctl kzalloc() won't actually fail because sizeof(*resize) is small, but static checkers complain. Signed-off-by: Dan Carpenter Acked-by: David Gibson Signed-off-by: Paul Mackerras --- 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);