summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-03-17 23:41:14 +0300
committerPaul Mackerras <paulus@ozlabs.org>2017-04-06 15:50:43 +1000
commitabd80dcbc400fac878202136645e9acf0e0bfbd9 (patch)
tree074ab31d87f6eda916f6b2819e807f57aca53b4f /arch
parent6fd6410311d618d80748b0a5dd3e8d6cd17662bc (diff)
downloadlinux-abd80dcbc400fac878202136645e9acf0e0bfbd9.tar.gz
linux-abd80dcbc400fac878202136645e9acf0e0bfbd9.tar.bz2
linux-abd80dcbc400fac878202136645e9acf0e0bfbd9.zip
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 <dan.carpenter@oracle.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_hv.c4
1 files changed, 4 insertions, 0 deletions
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);