netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] gianfar: irq_of_parse_and_map() error unnoticed
Date: Mon, 27 Apr 2009 12:23:16 -0700	[thread overview]
Message-ID: <20090427122316.1a8fec91.akpm@linux-foundation.org> (raw)
In-Reply-To: <49F5917A.3060909@gmail.com>

On Mon, 27 Apr 2009 13:05:30 +0200
Roel Kluin <roel.kluin@gmail.com> wrote:

> priv->interruptTransmit, -Receive and -Error are unsigned, so the error path
> wasn't taken when irq_of_parse_and_map() returned an incorrect irq.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> 
> ---
> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
> index b2c4967..55c2ce8 100644
> --- a/drivers/net/gianfar.c
> +++ b/drivers/net/gianfar.c
> @@ -203,9 +203,9 @@ static int gfar_of_init(struct net_device *dev)
>  
>  		priv->interruptError = irq_of_parse_and_map(np, 2);
>  
> -		if (priv->interruptTransmit < 0 ||
> -				priv->interruptReceive < 0 ||
> -				priv->interruptError < 0) {
> +		if (priv->interruptTransmit == NO_IRQ ||
> +				priv->interruptReceive == NO_IRQ ||
> +				priv->interruptError == NO_IRQ) {
>  			err = -EINVAL;
>  			goto err_out;
>  		}

I guess that's OK, as gianfar.c appears to be a ppc-only thing, and ppc
does implement NO_IRQ.

However what a lot (all) rtc drivers do is

	if (irq <= 0)

which (afaik) will dtrt in all cases: NO_IRQ==0, NO_IRQ<0,
!defined(NO_IRQ).

Then again, it will dtwt if the platform allows irq numbers of zero.

argh, how did we get into this pickle?

      reply	other threads:[~2009-04-27 19:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-23 12:52 [PATCH] gianfar: irq_of_parse_and_map() error unnoticed Roel Kluin
2009-04-27 10:11 ` David Miller
2009-04-27 11:05   ` [PATCH 2/2] " Roel Kluin
2009-04-27 19:23     ` Andrew Morton [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=20090427122316.1a8fec91.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.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 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).