devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Iles <jamie-wmLquQDDieKakBO8gow8eQ@public.gmane.org>
To: Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss
	<devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Subject: Re: [PATCH] irq: fix possible null-pointer deref irq_domain_to_irq
Date: Sun, 27 Nov 2011 15:24:29 +0000	[thread overview]
Message-ID: <20111127152411.GE28582@gallagher> (raw)
In-Reply-To: <4ED25305.8080605-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Hi Rob,

On Sun, Nov 27, 2011 at 09:11:01AM -0600, Rob Herring wrote:
> On 11/25/2011 09:35 AM, Jamie Iles wrote:
> > I wonder if this might make more sense instead.  I'll post a proper 
> > patch if you think so.
> > 
> > Regards,
> > 
> > Jamie
> > 
> > diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> > index 200ce83..92c3484 100644
> > --- a/kernel/irq/irqdomain.c
> > +++ b/kernel/irq/irqdomain.c
> > @@ -143,11 +143,6 @@ int irq_domain_simple_dt_translate(struct irq_domain *d,
> >  	return 0;
> >  }
> >  
> > -struct irq_domain_ops irq_domain_simple_ops = {
> > -	.dt_translate = irq_domain_simple_dt_translate,
> > -};
> > -EXPORT_SYMBOL_GPL(irq_domain_simple_ops);
> > -
> >  /**
> >   * irq_domain_create_simple() - Set up a 'simple' translation range
> >   */
> > @@ -181,4 +176,11 @@ void irq_domain_generate_simple(const struct of_device_id *match,
> >  		pr_info("no node found\n");
> >  }
> >  EXPORT_SYMBOL_GPL(irq_domain_generate_simple);
> > +#else /* CONFIG_OF_IRQ */
> > +#define irq_domain_simple_dt_translate NULL
> >  #endif /* CONFIG_OF_IRQ */
> > +
> > +struct irq_domain_ops irq_domain_simple_ops = {
> > +	.dt_translate = irq_domain_simple_dt_translate,
> 
> .dt_translate is surrounded by CONFIG_OF, so it will break on !CONFIG_OF.

Ahh, good spot!

> > +};
> > +EXPORT_SYMBOL_GPL(irq_domain_simple_ops);
> 
> The extern declaration in irqdomain.h is surrounded by CONFIG_OF_IRQ, so
> it needs to be moved out of that as well.
> 
> On Sparc, CONFIG_OF is true, but CONFIG_OF_IRQ is false. So that
> combination needs to be handled as well.

OK, I'm travelling for a couple of days now, but I'll respin something 
when I'm back.  I guess it's a case of always exporting the simple ops 
when CONFIG_IRQDOMAIN=y, and only setting the .dt_translate when 
CONFIG_OF_IRQ=y though.

Jamie

      parent reply	other threads:[~2011-11-27 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1320922383-15312-1-git-send-email-jamie@jamieiles.com>
     [not found] ` <20111110111446.GB16018@totoro>
     [not found]   ` <4EBBD39C.9000400@gmail.com>
     [not found]     ` <20111123122308.GA7382@totoro>
     [not found]       ` <20111125153553.GB8866@totoro>
2011-11-27 15:11         ` [PATCH] irq: fix possible null-pointer deref irq_domain_to_irq Rob Herring
     [not found]           ` <4ED25305.8080605-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-11-27 15:24             ` Jamie Iles [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=20111127152411.GE28582@gallagher \
    --to=jamie-wmlquqddiekakbo8gow8eq@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.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).