diff options
author | Randall Spangler <rspangler@chromium.org> | 2014-07-07 12:51:52 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-08 02:14:32 +0000 |
commit | 2c4432f609bc261603f40fa0e5eba5b975514477 (patch) | |
tree | 6f51bfbed441aa0a2ea604d92fce0f5acde50962 | |
parent | 66f4c2e700016124c15126fc0fe966d9de491653 (diff) | |
download | chrome-ec-2c4432f609bc261603f40fa0e5eba5b975514477.tar.gz |
flash: Fix bad check for flash_is_erased()
This caused all platforms to check only the first 25% of each page to
see if it's already erased. Fortunately, we tend to fill flash pages
from the beginning, so in normal usage we don't hit this bug.
BUG=chrome-os-partner:30281
BRANCH=all (if convenient)
TEST=Make sure CONFIG_CMD_FLASH is defined. Then at the EC console:
flasherase 0x1f000 0x400
rw 0x1f3e0 -> 0xffffffff
flashwrite 0x1f3e0 0x20
rw 0x1f3e0 -> 0x03020100
flasherase 0x1f000 0x400
rw 0x1f3e0 -> 0x03020100 (bad!) or 0xffffffff (good)
Change-Id: If78b08b5e0414993a440bc8cd707b5ce70eb1a0a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/206891
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
-rw-r--r-- | common/flash.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/flash.c b/common/flash.c index 770609e42d..b19096b9e3 100644 --- a/common/flash.c +++ b/common/flash.c @@ -120,7 +120,7 @@ int flash_is_erased(uint32_t offset, int size) (const char **)&ptr) < 0) return 0; - for (size /= sizeof(uint32_t); size > 0; size -= 4, ptr++) + for (size /= sizeof(uint32_t); size > 0; size--, ptr++) if (*ptr != CONFIG_FLASH_ERASED_VALUE32) return 0; |