From patchwork Mon Jun 25 12:42:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tetsuyuki Kobayashi X-Patchwork-Id: 167098 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id E43D41008E7 for ; Mon, 25 Jun 2012 22:42:45 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 07EA02808B; Mon, 25 Jun 2012 14:42:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id TQT05jU-VCqk; Mon, 25 Jun 2012 14:42:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F04A128080; Mon, 25 Jun 2012 14:42:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3542C28080 for ; Mon, 25 Jun 2012 14:42:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zXCojl86jUvv for ; Mon, 25 Jun 2012 14:42:39 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from vrgw7.firstserver.ne.jp (vrgw7.firstserver.ne.jp [164.46.1.105]) by theia.denx.de (Postfix) with ESMTPS id EB85A2807F for ; Mon, 25 Jun 2012 14:42:37 +0200 (CEST) Received: from fvrsp18.firstserver.ne.jp (fvrsp18.firstserver.ne.jp [203.183.56.4]) by vrgw7.firstserver.ne.jp (8.13.8/8.13.8/FirstServer) with ESMTP id q5PCgQX0010639; Mon, 25 Jun 2012 21:42:26 +0900 (envelope-from koba@kmckk.co.jp) Received: from 203.137.25.97 (203.137.25.97) by fvrsp18.firstserver.ne.jp (F-Secure/virusgw_smtp/407/fvrsp18.firstserver.ne.jp); Mon, 25 Jun 2012 21:42:26 +0900 (JST) X-Virus-Status: clean(F-Secure/virusgw_smtp/407/fvrsp18.firstserver.ne.jp) Received: from [192.168.1.110] (58-188-103-12f2.kns1.eonet.ne.jp [58.188.103.12]) (authenticated (0 bits)) by mail.kmckk.co.jp (8.14.3/8.11.3) with ESMTP id q5PCgQs1016648; Mon, 25 Jun 2012 21:42:26 +0900 Message-ID: <4FE85CB5.6070505@kmckk.co.jp> Date: Mon, 25 Jun 2012 21:42:29 +0900 From: Tetsuyuki Kobayashi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] arm: bugfix: save_boot_params_default accesses uninitalized stack when -O0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de save_boot_params_default() in cpu.c accesses uninitialized stack area when it compiled with -O0 (not optimized). Signed-off-by: Tetsuyuki Kobayashi --- arch/arm/cpu/armv7/cpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/cpu/armv7/cpu.c b/arch/arm/cpu/armv7/cpu.c index c6fa8ef..6104cb2 100644 --- a/arch/arm/cpu/armv7/cpu.c +++ b/arch/arm/cpu/armv7/cpu.c @@ -37,8 +37,11 @@ #include #include +__attribute__((naked)) /* don't save anything to stack even if compiled with -O0 */ void save_boot_params_default(u32 r0, u32 r1, u32 r2, u32 r3) { + /* stack is not yet initialized */ + asm("bx lr"); } void save_boot_params(u32 r0, u32 r1, u32 r2, u32 r3)