StorageManager: fixed hang in erase()

found by coverity
This commit is contained in:
Andrew Tridgell 2015-06-20 15:00:57 +10:00
parent 4eab27abe9
commit 81e6d88560
1 changed files with 1 additions and 1 deletions

View File

@ -97,7 +97,7 @@ void StorageManager::erase(void)
const StorageManager::StorageArea &area = StorageManager::layout[i];
uint16_t length = pgm_read_word(&area.length);
uint16_t offset = pgm_read_word(&area.offset);
for (uint8_t ofs=0; length; ofs += sizeof(blk)) {
for (uint16_t ofs=0; ofs<length; ofs += sizeof(blk)) {
uint8_t n = 16;
if (ofs + n > length) {
n = length - ofs;