Patchwork powerpc/5200: beyond ARRAY_SIZE of mpc52xx_uart_{ports, nodes}

login
register
mail settings
Submitter roel kluin
Date May 20, 2009, 12:28 a.m.
Message ID <4A134EC4.3000805@gmail.com>
Download mbox | patch
Permalink /patch/27436/
State Accepted
Delegated to: Grant Likely
Headers show

Comments

roel kluin - May 20, 2009, 12:28 a.m.
Do not go beyond ARRAY_SIZE of mpc52xx_uart_{ports,nodes}

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Wolfram Sang - May 20, 2009, 7:11 a.m.
On Wed, May 20, 2009 at 02:28:52AM +0200, Roel Kluin wrote:
> Do not go beyond ARRAY_SIZE of mpc52xx_uart_{ports,nodes}
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>

> ---
> diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
> index 7f72f8c..b3feb61 100644
> --- a/drivers/serial/mpc52xx_uart.c
> +++ b/drivers/serial/mpc52xx_uart.c
> @@ -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;
>  	}
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

Patch

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 7f72f8c..b3feb61 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -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;
 	}