aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorImre Kaloz <kaloz@openwrt.org>2015-04-12 14:46:19 +0000
committerImre Kaloz <kaloz@openwrt.org>2015-04-12 14:46:19 +0000
commit7d17c7d21e73314ddced65541f87072937eeee9d (patch)
tree43f89e26b14105317cdd2b0476c0fa9c4867eb45 /target
parent3be08a4b90cec85e1e8c72f3b590e9a7444dafca (diff)
downloadmaster-187ad058-7d17c7d21e73314ddced65541f87072937eeee9d.tar.gz
master-187ad058-7d17c7d21e73314ddced65541f87072937eeee9d.tar.bz2
master-187ad058-7d17c7d21e73314ddced65541f87072937eeee9d.zip
generic: make sure we only try to mangle bootargs we do have
Signed-off-by: Imre Kaloz <kaloz@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@45393 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/patches-3.18/995-mangle_bootargs.patch21
-rw-r--r--target/linux/generic/patches-4.0/995-mangle_bootargs.patch21
2 files changed, 24 insertions, 18 deletions
diff --git a/target/linux/generic/patches-3.18/995-mangle_bootargs.patch b/target/linux/generic/patches-3.18/995-mangle_bootargs.patch
index 5d56cf4462..0029e90822 100644
--- a/target/linux/generic/patches-3.18/995-mangle_bootargs.patch
+++ b/target/linux/generic/patches-3.18/995-mangle_bootargs.patch
@@ -1,8 +1,8 @@
--- a/init/main.c
+++ b/init/main.c
-@@ -379,6 +379,26 @@ static void __init setup_command_line(ch
- strcpy(static_command_line, command_line);
- }
+@@ -362,6 +362,29 @@ static inline void setup_nr_cpu_ids(void
+ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
+ #endif
+#ifdef CONFIG_MANGLE_BOOTARGS
+static void __init mangle_bootargs(char *command_line)
@@ -11,10 +11,14 @@
+ char *rootfs;
+
+ rootdev = strstr(command_line, "root=/dev/mtdblock");
-+ strncpy(rootdev, "mangled_rootblock=", 18);
++
++ if (rootdev)
++ strncpy(rootdev, "mangled_rootblock=", 18);
+
+ rootfs = strstr(command_line, "rootfstype");
-+ strncpy(rootfs, "mangled_fs", 10);
++
++ if (rootfs)
++ strncpy(rootfs, "mangled_fs", 10);
+
+}
+#else
@@ -23,11 +27,10 @@
+}
+#endif
+
-+
/*
- * We need to finalize in a non-__init function or else race conditions
- * between the root thread and the init thread may cause start_kernel to
-@@ -530,6 +550,7 @@ asmlinkage __visible void __init start_k
+ * We need to store the untouched command line for future reference.
+ * We also need to store the touched command line since the parameter
+@@ -530,6 +553,7 @@ asmlinkage __visible void __init start_k
pr_notice("%s", linux_banner);
setup_arch(&command_line);
mm_init_cpumask(&init_mm);
diff --git a/target/linux/generic/patches-4.0/995-mangle_bootargs.patch b/target/linux/generic/patches-4.0/995-mangle_bootargs.patch
index 38df82acc1..ebfc6d86fc 100644
--- a/target/linux/generic/patches-4.0/995-mangle_bootargs.patch
+++ b/target/linux/generic/patches-4.0/995-mangle_bootargs.patch
@@ -1,8 +1,8 @@
--- a/init/main.c
+++ b/init/main.c
-@@ -368,6 +368,26 @@ static void __init setup_command_line(ch
- strcpy(static_command_line, command_line);
- }
+@@ -351,6 +351,29 @@ static inline void setup_nr_cpu_ids(void
+ static inline void smp_prepare_cpus(unsigned int maxcpus) { }
+ #endif
+#ifdef CONFIG_MANGLE_BOOTARGS
+static void __init mangle_bootargs(char *command_line)
@@ -11,10 +11,14 @@
+ char *rootfs;
+
+ rootdev = strstr(command_line, "root=/dev/mtdblock");
-+ strncpy(rootdev, "mangled_rootblock=", 18);
++
++ if (rootdev)
++ strncpy(rootdev, "mangled_rootblock=", 18);
+
+ rootfs = strstr(command_line, "rootfstype");
-+ strncpy(rootfs, "mangled_fs", 10);
++
++ if (rootfs)
++ strncpy(rootfs, "mangled_fs", 10);
+
+}
+#else
@@ -23,11 +27,10 @@
+}
+#endif
+
-+
/*
- * We need to finalize in a non-__init function or else race conditions
- * between the root thread and the init thread may cause start_kernel to
-@@ -519,6 +539,7 @@ asmlinkage __visible void __init start_k
+ * We need to store the untouched command line for future reference.
+ * We also need to store the touched command line since the parameter
+@@ -519,6 +542,7 @@ asmlinkage __visible void __init start_k
pr_notice("%s", linux_banner);
setup_arch(&command_line);
mm_init_cpumask(&init_mm);