Skip to content

Fix hang trying to protect flash sectors

Stefan Roese u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 1 patch 0 repliesNew

Patches in v1 No applies recorded yet

The patch the cover letter announces is not in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/1] Fix hang trying to protect flash sectors

Hi Mark,

Quoted 4 lines · 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?

Quoted 4 lines

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?

Quoted 7 lines

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