* [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
* Re: [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl
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
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2017-03-20 4:20 UTC (permalink / raw)
To: Dan Carpenter
Cc: Paolo Bonzini, Radim Krčmář, Alexander Graf,
Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, kvm,
kvm-ppc, linuxppc-dev, kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
On Fri, Mar 17, 2017 at 11:41:14PM +0300, Dan Carpenter wrote:
> kzalloc() won't actually fail because sizeof(*resize) is small, but
> static checkers complain.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Oops, that's an embarrassing mistake.
Acked-by: David Gibson <david@gibson.dropbear.id.au>
>
> 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);
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [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).