You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2018/08/01 22:54:21 UTC

[GitHub] ccollins476ad commented on issue #1307: Boot loader: Add assert for sector count

ccollins476ad commented on issue #1307: Boot loader: Add assert for sector count
URL: https://github.com/apache/mynewt-core/pull/1307#issuecomment-409751339
 
 
   I think elsewhere in the code, this condition is handled by calling `flash_area_to_sectors()` twice.  In the first call, `NULL` is passed for the last argument to indicate that the caller just wants to know the sector count.  After verifying that the count is not too large, the caller calls `flash_area_to_sectors()` again, but passes the actual buffer for the last argument.  An example where this is done is `config_init_fcb()`.  I think this is preferable because it catches the problem before corruption occurs, ensuring the sector count is accurately read.
   
   It is odd that `boot_read_sectors()` assigns `num_sectors_slot0` and `num_sectors_slot1`, since they get overwritten by `flash_area_to_sectors()` anyway.  I know you didn't write this part, but these two lines should probably be deleted.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services