Skip to content
Snippets Groups Projects
Commit af567301 authored by Martin Krause's avatar Martin Krause Committed by Stefan Roese
Browse files

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: default avatarMartin Krause <martin.krause@tqs.de>
Signed-off-by: default avatarStefan Roese <sr@denx.de>
parent cb815e5f
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment