[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20081110143039.6f21fdc3.akpm@linux-foundation.org>
Date: Mon, 10 Nov 2008 14:30:39 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Alan Cox <alan@...rguk.ukuu.org.uk>
Cc: kosaki.motohiro@...fujitsu.com, linux-serial@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] serial/8250: fix uninitialized warnings
On Tue, 4 Nov 2008 17:41:42 +0000
Alan Cox <alan@...rguk.ukuu.org.uk> wrote:
> On Wed, 5 Nov 2008 02:26:00 +0900 (JST)
> KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com> wrote:
>
> >
> > fix following warnings.
> >
> > drivers/serial/8250.c: In function ___serial8250_shutdown___:
> > drivers/serial/8250.c:1612: warnings: ___i___ may be used uninitialized in this function
>
> NAK
>
> This is an incorrect compiler warning. It's also one that current gcc
> does not emit warnings for.
>
That's a regression in current gcc, surely?
static void serial_unlink_irq_chain(struct uart_8250_port *up)
{
struct irq_info *i;
struct hlist_node *n;
struct hlist_head *h;
mutex_lock(&hash_mutex);
h = &irq_lists[up->port.irq % NR_IRQ_HASH];
hlist_for_each(n, h) {
i = hlist_entry(n, struct irq_info, node);
if (i->irq == up->port.irq)
break;
}
BUG_ON(n == NULL);
BUG_ON(i->head == NULL);
#define hlist_for_each(pos, head) \
for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \
pos = pos->next)
hlist_for_each() can execute that loop zero times, in which case
serial_unlink_irq_chain will dereference an uninitialised variable.
Presumably the list shouldn't be empty at this stage, but this
is not particularly robust behaviour if that should happen..
--
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