Skip to content

Commit 8756183

Browse files
authored
Merge pull request #7299 from ARMmbed/g-fix-mbr-invalid
MBR: Fix issue with MBR init asserting on bad partition size
2 parents 24efa4c + 28a7830 commit 8756183

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

features/filesystem/bd/MBRBlockDevice.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ int MBRBlockDevice::init()
241241
_size = fromle32(table->entries[_part-1].lba_size) * sector;
242242

243243
// Check that block addresses are valid
244-
MBED_ASSERT(_bd->is_valid_erase(_offset, _size));
244+
if (!_bd->is_valid_erase(_offset, _size)) {
245+
return BD_ERROR_INVALID_PARTITION;
246+
}
245247

246248
delete[] buffer;
247249
return 0;

0 commit comments

Comments
 (0)