-
Notifications
You must be signed in to change notification settings - Fork 3k
mbr: Added assertions for overlapping partitions #6700
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@mottigondabi please review |
@@ -96,6 +96,7 @@ static int partition_absolute( | |||
table->entries[part-1].type = type; | |||
|
|||
// lba dimensions | |||
MBED_ASSERT(bd->is_valid_erase(offset, size)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering... shouldn't the assert work on LBA? if yes, it should be moved to L103 MBED_ASSERT(bd->is_valid_erase(lba_offset, lba_size));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, lba_offset and lba_size is in units of erase blocks. The offset and size are in units of bytes. bd->is_valid_erase operates in units of bytes.
We could also have an assert on lba_offset and lba_size but I thought it would be redundant. Do you think we should have that as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, don't bother.
Approvals/request changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍
/morph build |
Build : SUCCESSBuild number : 1868 Triggering tests/morph test |
Exporter Build : FAILUREBuild number : 1515 |
/morph export-build |
Test : FAILUREBuild number : 1679 |
/morph test |
Exporter Build : SUCCESSBuild number : 1519 |
Test : SUCCESSBuild number : 1686 |
Description
Add asserts for overlapping MBR parititions. This takes advantage of "is_valid_erase" of the underlying block device, but then has to iterate through all partitions to check if any overlap.
related IOTMORF-2320
cc @deepikabhavnani, @JaniSuonpera, @jenia81, @mottigondabi
Pull request type
[ ] Fix
[ ] Refactor
[ ] New target
[x] Feature
[ ] Breaking change