KVM: PPC: Book3S HV: check for kmalloc errors in ioctl
Subsystems (4)
PATCH 1/1 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 <[email protected]>
arch/powerpc/kvm/book3s_64_mmu_hv.c +4 -0
@@ -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);
Quoted 4 lines · Dan Carpenter
kzalloc()won't actually fail becausesizeof(*resize)is small, but static checkers complain.Signed-off-by Dan Carpenter <[email protected]>
Oops, that's an embarrassing mistake.
Acked-by David Gibson <[email protected]>
Quoted 17 lines
arch/powerpc/kvm/book3s_64_mmu_hv.c +4
-0@@ -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);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson