From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Tue, 18 May 2010 10:20:55 +0200 Subject: [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors In-Reply-To: <1274160395-9308-1-git-send-email-mark.tomlinson@alliedtelesis.co.nz> References: <1274160395-9308-1-git-send-email-mark.tomlinson@alliedtelesis.co.nz> Message-ID: <201005181020.55735.sr@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Mark, On Tuesday 18 May 2010 07:26:34 Mark Tomlinson wrote: > Our hardware has part of the flash mapped in two address ranges. > The CONFIG_SYS_MONITOR_BASE is in the upper 'boot' area, whereas > the CONFIG_SYS_FLASH_BANKS_LIST has the full flash available at > a lower address. Just to be sure: You have 2 FLASH chips? Mapped at which addresses? And where does CONFIG_SYS_MONITOR_BASE point to? > This all works fine until the code in cfi_flash.c:flash_init(), which > uses flash_get_info() to find the flash_info_t associated with the > monitor and environment. These are not in the probed flash range, so > flash_get_info() returns NULL. You mean that "flash_get_info(CONFIG_SYS_MONITOR_BASE)" returns NULL? Please explain again, why is this the case? > This is not checked and is passed > directly to flash_protect(). Since flash_protect() was not checking > for this NULL pointer either, random memory would be clobbered > causing the device to lock up. > > This patch changes flash_protect() to check for the NULL, and the > error goes unreported. I would prefer to fix the real problem, that flash_get_info() returns NULL, instead. Cheers, Stefan -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de