From patchwork Mon Dec 27 10:27:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minkyu Kang X-Patchwork-Id: 76784 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 DD761B70ED for ; Mon, 27 Dec 2010 21:27:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9820C280A2; Mon, 27 Dec 2010 11:27:41 +0100 (CET) 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 pqoeD-9TrfxE; Mon, 27 Dec 2010 11:27:41 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4199280A4; Mon, 27 Dec 2010 11:27:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 169E3280A4 for ; Mon, 27 Dec 2010 11:27:38 +0100 (CET) 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 q51m08Zaw4dq for ; Mon, 27 Dec 2010 11:27:36 +0100 (CET) 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 mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id 05094280A2 for ; Mon, 27 Dec 2010 11:27:34 +0100 (CET) Received: from epmmp2 (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Exchange Server 7u4-19.01 64bit (built Sep 7 2010)) with ESMTP id <0LE3009P911VRU50@mailout4.samsung.com> for u-boot@lists.denx.de; Mon, 27 Dec 2010 19:27:31 +0900 (KST) Received: from TNRNDGASPAPP1.tn.corp.samsungelectronics.net ([165.213.149.150]) by mmp2.samsung.com (iPlanet Messaging Server 5.2 Patch 2 (built Jul 14 2004)) with ESMTPA id <0LE3009C711V9Z@mmp2.samsung.com> for u-boot@lists.denx.de; Mon, 27 Dec 2010 19:27:31 +0900 (KST) Received: from [10.89.9.135] ([10.89.9.135]) by TNRNDGASPAPP1.tn.corp.samsungelectronics.net with Microsoft SMTPSVC(6.0.3790.4675); Mon, 27 Dec 2010 19:27:31 +0900 Date: Mon, 27 Dec 2010 19:27:31 +0900 From: Minkyu Kang To: u-boot@lists.denx.de, albert.aribaud@free.fr Message-id: <4D186A13.4080004@samsung.com> MIME-version: 1.0 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ko; rv:1.9.2.7) Gecko/20100713 Thunderbird/3.1.1 X-OriginalArrivalTime: 27 Dec 2010 10:27:31.0242 (UTC) FILETIME=[AB0798A0:01CBA5B0] Subject: [U-Boot] [PATCH RFC] armv7: fixloop: don't fixup if location is NULL X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 There is possibility that pointers set to NULL before relocation. In this case, system is hang, because of r0 is invalid location in RAM. Signed-off-by: Minkyu Kang --- arch/arm/cpu/armv7/start.S | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 684f2d2..4eeb12a 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -195,6 +195,8 @@ copy_loop: add r3, r3, r0 /* r3 <- rel dyn end in FLASH */ fixloop: ldr r0, [r2] /* r0 <- location to fix up, IN FLASH! */ + cmp r0, #0 + beq fixskip add r0, r0, r9 /* r0 <- location to fix up in RAM */ ldr r1, [r2, #4] and r7, r1, #0xff @@ -217,6 +219,7 @@ fixrel: add r1, r1, r9 fixnext: str r1, [r0] +fixskip: add r2, r2, #8 /* each rel.dyn entry is 8 bytes */ cmp r2, r3 blo fixloop