linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: linuxppc-dev@lists.ozlabs.org
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Michael Ellerman <mpe@ellerman.id.au>
Subject: Re: [PATCH kernel v2] powerpc/powernv: Check kzalloc() return value in pnv_pci_table_alloc
Date: Fri, 28 Apr 2017 16:21:10 +1000	[thread overview]
Message-ID: <20170428162110.5cab6692@aik.ozlabs.ibm.com> (raw)
In-Reply-To: <49ac3f79-6f23-f6ab-6860-8cff16faf5de@ozlabs.ru>

On Tue, 11 Apr 2017 18:28:42 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> On 27/03/17 19:27, Alexey Kardashevskiy wrote:
> > pnv_pci_table_alloc() ignores possible failure from kzalloc_node(),
> > this adds a check. There are 2 callers of pnv_pci_table_alloc(),
> > one already checks for tbl!=NULL, this adds WARN_ON() to the other path
> > which only happens during boot time in IODA1 and not expected to fail.
> > 
> > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > ---
> > Changes:
> > v2:
> > * s/BUG_ON/WARN_ON/  
> 
> Bad/good?

Ping?


> 
> 
> > ---
> >  arch/powerpc/platforms/powernv/pci-ioda.c | 3 +++
> >  arch/powerpc/platforms/powernv/pci.c      | 3 +++
> >  2 files changed, 6 insertions(+)
> > 
> > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> > index e36738291c32..04ef03a5201b 100644
> > --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> > @@ -2128,6 +2128,9 @@ static void pnv_pci_ioda1_setup_dma_pe(struct pnv_phb *phb,
> >  
> >  found:
> >  	tbl = pnv_pci_table_alloc(phb->hose->node);
> > +	if (WARN_ON(!tbl))
> > +		return;
> > +
> >  	iommu_register_group(&pe->table_group, phb->hose->global_number,
> >  			pe->pe_number);
> >  	pnv_pci_link_table_and_group(phb->hose->node, 0, tbl, &pe->table_group);
> > diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> > index eb835e977e33..9acdf6889c0d 100644
> > --- a/arch/powerpc/platforms/powernv/pci.c
> > +++ b/arch/powerpc/platforms/powernv/pci.c
> > @@ -766,6 +766,9 @@ struct iommu_table *pnv_pci_table_alloc(int nid)
> >  	struct iommu_table *tbl;
> >  
> >  	tbl = kzalloc_node(sizeof(struct iommu_table), GFP_KERNEL, nid);
> > +	if (!tbl)
> > +		return NULL;
> > +
> >  	INIT_LIST_HEAD_RCU(&tbl->it_group_list);
> >  
> >  	return tbl;
> >   
> 
> 



--
Alexey

  reply	other threads:[~2017-04-28  6:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27  8:27 [PATCH kernel v2] powerpc/powernv: Check kzalloc() return value in pnv_pci_table_alloc Alexey Kardashevskiy
2017-04-11  8:28 ` Alexey Kardashevskiy
2017-04-28  6:21   ` Alexey Kardashevskiy [this message]
2017-05-01  2:58 ` [kernel, " Michael Ellerman

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=20170428162110.5cab6692@aik.ozlabs.ibm.com \
    --to=aik@ozlabs.ru \
    --cc=david@gibson.dropbear.id.au \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /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).