]> git.kernelconcepts.de Git - karo-tx-uboot.git/commit
cfi_flash: fix bug with flash banks with different sector numbers
authorMartin Krause <martin.krause@tqs.de>
Mon, 21 Mar 2011 17:07:56 +0000 (18:07 +0100)
committerStefan Roese <sr@denx.de>
Mon, 28 Mar 2011 17:06:51 +0000 (19:06 +0200)
commitaf5673015315d069b7e2d64acbbf8b5f5fcc385d
treefedb2f6d8a7f312d1d25f3a4e22464be93bfa6a2
parentcb815e5ff979e36d68df130a810d34de4bf93289
cfi_flash: fix bug with flash banks with different sector numbers

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.

Signed-off-by: Martin Krause <martin.krause@tqs.de>
Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/cfi_flash.c