Merge pull request #7299 from ARMmbed/g-fix-mbr-invalid

MBR: Fix issue with MBR init asserting on bad partition size
pull/7324/head
Martin Kojtal 2018-06-25 17:45:12 +02:00 committed by GitHub
commit 8756183478
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -241,7 +241,9 @@ int MBRBlockDevice::init()
_size = fromle32(table->entries[_part-1].lba_size) * sector;
// Check that block addresses are valid
MBED_ASSERT(_bd->is_valid_erase(_offset, _size));
if (!_bd->is_valid_erase(_offset, _size)) {
return BD_ERROR_INVALID_PARTITION;
}
delete[] buffer;
return 0;