13ffbac035eaa3e43197de98df7e1392a8a379f2
[openwrt.git] / target / linux / lantiq / patches-3.2 / 0012-MIPS-lantiq-fix-cmdline-parsing.patch
1 From 9c1b1cde50b09dd3679d74cde07694cee32c8b19 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Fri, 12 Aug 2011 16:27:38 +0200
4 Subject: [PATCH 12/73] MIPS: lantiq: fix cmdline parsing
5
6 The code tested if the KSEG1 mapped address of argv was != 0. We need to use
7 CPHYSADDR instead to make the conditional actually work.
8
9 Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12  arch/mips/lantiq/prom.c |    6 ++++--
13  1 files changed, 4 insertions(+), 2 deletions(-)
14
15 diff --git a/arch/mips/lantiq/prom.c b/arch/mips/lantiq/prom.c
16 index e3b1e25..acb8921 100644
17 --- a/arch/mips/lantiq/prom.c
18 +++ b/arch/mips/lantiq/prom.c
19 @@ -49,10 +49,12 @@ static void __init prom_init_cmdline(void)
20         char **argv = (char **) KSEG1ADDR(fw_arg1);
21         int i;
22  
23 +       arcs_cmdline[0] = '\0';
24 +
25         for (i = 0; i < argc; i++) {
26 -               char *p = (char *)  KSEG1ADDR(argv[i]);
27 +               char *p = (char *) KSEG1ADDR(argv[i]);
28  
29 -               if (p && *p) {
30 +               if (CPHYSADDR(p) && *p) {
31                         strlcat(arcs_cmdline, p, sizeof(arcs_cmdline));
32                         strlcat(arcs_cmdline, " ", sizeof(arcs_cmdline));
33                 }
34 -- 
35 1.7.9.1
36