From 6f0dba85a92b55f67a3610241060caaa41b5939e Mon Sep 17 00:00:00 2001 From: Tetsuyuki Kobayashi Date: Fri, 6 Jul 2012 21:14:20 +0000 Subject: [PATCH] arm: bugfix: save_boot_params_default accesses uninitalized stack when -O0 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 Acked-by: Tom Rini --- arch/arm/cpu/armv7/cpu.c | 7 ------- arch/arm/cpu/armv7/start.S | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c index f01989fbf5..39a80237cd 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -38,13 +38,6 @@ #include #include -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) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index b06bafde91..32658eb7a5 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -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 -- 2.39.5