linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: linuxppc-dev@lists.ozlabs.org,
	Alex Williamson <alex.williamson@redhat.com>,
	kvm-ppc@vger.kernel.org, kvm@vger.kernel.org,
	Paul Mackerras <paulus@samba.org>
Subject: Re: [PATCH kernel] KVM: PPC: Check kzalloc() return
Date: Mon, 27 Mar 2017 15:25:17 +1100	[thread overview]
Message-ID: <20170327042517.GV19078@umbus.fritz.box> (raw)
In-Reply-To: <20170327031927.18572-1-aik@ozlabs.ru>

[-- Attachment #1: Type: text/plain, Size: 1198 bytes --]

On Mon, Mar 27, 2017 at 02:19:27PM +1100, Alexey Kardashevskiy wrote:
> This adds missing check for failed kzalloc().
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> 
> This is a followup change for:
> [PATCH kernel v11 10/10] KVM: PPC: VFIO: Add in-kernel acceleration for VFIO
> 
> Please squash it. Thanks!
> ---
>  arch/powerpc/kvm/book3s_64_vio.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
> index 22c67a47eaab..c3d8a88f1f4e 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -212,6 +212,11 @@ extern long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
>  	}
>  
>  	stit = kzalloc(sizeof(*stit), GFP_KERNEL);
> +	if (!stit) {
> +		iommu_tce_table_put(tbl);
> +		return -ENOMEM;
> +	}
> +
>  	stit->tbl = tbl;
>  	kref_init(&stit->kref);
>  

-- 
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 --]

      reply	other threads:[~2017-03-27  6:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  3:19 [PATCH kernel] KVM: PPC: Check kzalloc() return Alexey Kardashevskiy
2017-03-27  4:25 ` David Gibson [this message]

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=20170327042517.GV19078@umbus.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /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 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).