From: David Gibson <david@gibson.dropbear.id.au>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Alexander Graf" <agraf@suse.com>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl
Date: Mon, 20 Mar 2017 04:20:47 +0000 [thread overview]
Message-ID: <20170320042047.GA29814@umbus.fritz.box> (raw)
In-Reply-To: <20170317204113.GA16505@mwanda>
[-- 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 --]
WARNING: multiple messages have this Message-ID (diff)
From: David Gibson <david@gibson.dropbear.id.au>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Alexander Graf" <agraf@suse.com>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl
Date: Mon, 20 Mar 2017 15:20:47 +1100 [thread overview]
Message-ID: <20170320042047.GA29814@umbus.fritz.box> (raw)
In-Reply-To: <20170317204113.GA16505@mwanda>
[-- 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 --]
next prev parent reply other threads:[~2017-03-20 4:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 20:41 [patch] KVM: PPC: Book3S HV: check for kmalloc errors in ioctl Dan Carpenter
2017-03-17 20:41 ` Dan Carpenter
2017-03-17 20:41 ` Dan Carpenter
2017-03-20 4:20 ` David Gibson [this message]
2017-03-20 4:20 ` David Gibson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170320042047.GA29814@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=agraf@suse.com \
--cc=benh@kernel.crashing.org \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.