arm: bugfix: save_boot_params_default accesses uninitalized stack when -O0
authorTetsuyuki Kobayashi <koba@kmckk.co.jp>
Fri, 6 Jul 2012 21:14:20 +0000 (21:14 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 1 Sep 2012 12:58:22 +0000 (14:58 +0200)
save_boot_params_default() in cpu.c accesses uninitialized stack area
when it compiled with -O0 (not optimized).
This patch removes save_boot_params_default() and put the equivalent in start.S

Signed-off-by: Tetsuyuki Kobayashi <koba@kmckk.co.jp>
Acked-by: Tom Rini <trini@ti.com>
arch/arm/cpu/armv7/cpu.c
arch/arm/cpu/armv7/start.S

index f01989fbf58005d09a1ae09ef64d9d2994c7a53b..39a80237cd1edf08f23497cc36580aa782701877 100644 (file)
 #include <asm/armv7.h>
 #include <linux/compiler.h>
 
-void save_boot_params_default(u32 r0, u32 r1, u32 r2, u32 r3)
-{
-}
-
-void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
-       __attribute__((weak, alias("save_boot_params_default")));
-
 void __weak cpu_cache_initialization(void){}
 
 int cleanup_before_linux(void)
index b06bafde912a5acb2dbb7b496b5ed28c32ac16cb..32658eb7a53d15437265c043809242608b56af08 100644 (file)
@@ -303,6 +303,20 @@ _board_init_r_ofs:
        .word board_init_r - _start
 ENDPROC(relocate_code)
 
+/*************************************************************************
+ *
+ * void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)
+ *     __attribute__((weak));
+ *
+ * Stack pointer is not yet initialized at this moment
+ * Don't save anything to stack even if compiled with -O0
+ *
+ *************************************************************************/
+ENTRY(save_boot_params)
+       bx      lr                      @ back to my caller
+ENDPROC(save_boot_params)
+       .weak   save_boot_params
+
 /*************************************************************************
  *
  * cpu_init_cp15