linux-mips
[Top] [All Lists]

potential problem in au1000_generic.c

To: linux-mips@linux-mips.org
Subject: potential problem in au1000_generic.c
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 13 Sep 2005 10:49:11 +0900 (JST)
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
I found a potential probelm in au1x00_pcmcia_socket_probe().

This function roughly looks like:

int au1x00_pcmcia_socket_probe(struct device *dev, struct pcmcia_low_level 
*ops, int first, int nr)
{
...
        for (i = 0; i < nr; i++) {
                struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
...
                ret = pcmcia_register_socket(&skt->socket);
                if (ret)
                        goto out_err;
...
        }
...
        return 0;

        do {
                struct au1000_pcmcia_socket *skt = PCMCIA_SOCKET(i);
...
out_err:
...
                ops->hw_shutdown(skt);
                i--;
        } while (i > 0);
...
}

The 'out_err' path seems broken since 'skt' in for-loop and
do-while-loop are another variable.  The local variable 'skt' should
be declared outside those loop.

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>
  • potential problem in au1000_generic.c, Atsushi Nemoto <=