drivers/serial/mpc52xx_uart.c: fix array overindexing check
authorRoel Kluin <roel.kluin@gmail.com>
Thu, 28 May 2009 21:34:29 +0000 (14:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 29 May 2009 15:40:02 +0000 (08:40 -0700)
The check for an overindexing of mpc52xx_uart_{ports,nodes} has an
off-by-one.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/serial/mpc52xx_uart.c

index 7f72f8c..b3feb61 100644 (file)
@@ -988,7 +988,7 @@ mpc52xx_console_setup(struct console *co, char *options)
        pr_debug("mpc52xx_console_setup co=%p, co->index=%i, options=%s\n",
                 co, co->index, options);
 
-       if ((co->index < 0) || (co->index > MPC52xx_PSC_MAXNUM)) {
+       if ((co->index < 0) || (co->index >= MPC52xx_PSC_MAXNUM)) {
                pr_debug("PSC%x out of range\n", co->index);
                return -EINVAL;
        }