[U-Boot] [PATCH] cfi_flash: fix bug with flash banks with different sector numbers

Stefan Roese
2011-03-28T17:32:31Z

On Monday 21 March 2011 18:07:56 Martin Krause wrote:
> The function find_sector() does not take into account if the flash bank
> has changed since the last call. This could lead to illegal accesses inside
> and beyond the flash_info_t info strcture. For example if the current
> flash bank has less sectors than the last used flash bank.
>
> This patch adds two cheks. One that insures, that the current sector does
> not exceed the allowed maximum (which is always a good idea). And one that
> checks if the current access is to the same flash bank as the last access.
> If not, the search loop will start with sector 0.

Applied to u-boot-cfi-flash/master. Thanks.

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