linux-mips
[Top] [All Lists]

Re: [PATCH 06/35] MIPS: ath79: Cleanup firmware support for the ath79 pl

To: "Steven J. Hill" <sjhill@mips.com>
Subject: Re: [PATCH 06/35] MIPS: ath79: Cleanup firmware support for the ath79 platform.
From: Gabor Juhos <juhosg@openwrt.org>
Date: Wed, 06 Jun 2012 15:04:37 +0200
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <1338931179-9611-7-git-send-email-sjhill@mips.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1338931179-9611-1-git-send-email-sjhill@mips.com> <1338931179-9611-7-git-send-email-sjhill@mips.com>
Sender: linux-mips-bounce@linux-mips.org
Hi Steven,

2012.06.05. 23:19 keltezéssel, Steven J. Hill írta:
> From: "Steven J. Hill" <sjhill@mips.com>
> 
> Signed-off-by: Steven J. Hill <sjhill@mips.com>
> ---
>  arch/mips/ath79/prom.c |   20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/mips/ath79/prom.c b/arch/mips/ath79/prom.c
> index e9cbd7c..adbe614 100644
> --- a/arch/mips/ath79/prom.c
> +++ b/arch/mips/ath79/prom.c
> @@ -14,7 +14,7 @@
>  #include <linux/io.h>
>  #include <linux/string.h>
>  
> -#include <asm/bootinfo.h>
> +#include <asm/fw/fw.h>
>  #include <asm/addrspace.h>
>  
>  #include "common.h"
> @@ -32,23 +32,11 @@ static inline int is_valid_ram_addr(void *addr)
>       return 0;
>  }
>  
> -static __init void ath79_prom_init_cmdline(int argc, char **argv)
> -{
> -     int i;
> -
> -     if (!is_valid_ram_addr(argv))
> -             return;
> -
> -     for (i = 0; i < argc; i++)
> -             if (is_valid_ram_addr(argv[i])) {

Please don't remove this validation. The Atheros AR7xxx/AR9xxx based boards are
using various bootloaders. Some of them puts insane values in argv, and this
validation ensures that the kernel will not crash with them.

> -                     strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
> -                     strlcat(arcs_cmdline, argv[i], sizeof(arcs_cmdline));
> -             }
> -}
> -
>  void __init prom_init(void)
>  {
> -     ath79_prom_init_cmdline(fw_arg0, (char **)fw_arg1);
> +     if (!is_valid_ram_addr((int *)fw_arg1))

The 'is_valid_ram_addr' function requires a 'void *' argument, so it would be
more precise to use that instead of 'int *' in the cast.

> +             return;
> +     fw_init_cmdline();
>  }
>  
>  void __init prom_free_prom_memory(void)

-Gabor

<Prev in Thread] Current Thread [Next in Thread>