[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080123140414.e1ff2263.akpm@linux-foundation.org>
Date: Wed, 23 Jan 2008 14:04:14 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: jeff@...zik.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] BUG_ON() bad input to request_irq
> On Thu, 17 Jan 2008 17:59:58 +1100 Rusty Russell <rusty@...tcorp.com.au> wrote:
> Is there any reason why these bugs should be treated gently? The
> caller might not want to check NR_IRQS and IRQ_NOREQUEST cases, but
> a NULL handler or NULL dev_id w/ shared are coding bugs.
>
> Signed-off-by: Rusty Russell <rusty@...tcorp.com.au>
> ---
> kernel/irq/manage.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff -r c2eb8ef5a0be kernel/irq/manage.c
> --- a/kernel/irq/manage.c Thu Jan 17 15:48:03 2008 +1100
> +++ b/kernel/irq/manage.c Thu Jan 17 15:49:33 2008 +1100
> @@ -532,13 +532,12 @@ int request_irq(unsigned int irq, irq_ha
> * which interrupt is which (messes up the interrupt freeing
> * logic etc).
> */
> - if ((irqflags & IRQF_SHARED) && !dev_id)
> - return -EINVAL;
> + BUG_ON((irqflags & IRQF_SHARED) && !dev_id);
> + BUG_ON(!handler);
> +
> if (irq >= NR_IRQS)
> return -EINVAL;
> if (irq_desc[irq].status & IRQ_NOREQUEST)
> - return -EINVAL;
> - if (!handler)
> return -EINVAL;
>
> action = kmalloc(sizeof(struct irqaction), GFP_ATOMIC);
If no driver is passing in args which will trigger this BUG, we presumably
don't need the patch.
If some driver _is_ passing in ags which will trigger these BUGs then it is
presumably working OK anyway. Taking a working system and making it go BUG
is likely to upset people.
IOW: WARN_ON, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists