mingming cheng commented on a discussion on cpukit/dev/flash/flashdev.c: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1280#note_152167

 >    alloc_array_len = RTEMS_FLASHDEV_BITALLOC_LENGTH( table ) +
 >                      ( ( RTEMS_FLASHDEV_BITALLOC_FINAL_BITS( table ) ) != 0 
 > );
 >  
 > -  memset( table->bit_allocator, 0, alloc_array_len );
 > +  memset( table->bit_allocator, 0, alloc_array_len * sizeof( uint32_t ) );

Thanks for the review. I've reworked the patch as suggested:

1.Renamed RTEMS_FLASHDEV_BITALLOC_LENGTH to 
RTEMS_FLASHDEV_BITALLOC_WORD_LENGTH. It now returns the full number of uint32_t 
words (rounded up), so the separate RTEMS_FLASHDEV_BITALLOC_FINAL_BITS rounding 
at the call site is no longer needed and has been removed.

2.Added RTEMS_FLASHDEV_BITALLOC_BYTE_LENGTH, defined as the word length times 
sizeof(uint32_t).

3.rtems_flashdev_register() now clears the whole bitmap with 
memset(table-\>bit_allocator, 0, RTEMS_FLASHDEV_BITALLOC_BYTE_LENGTH(table)) 
instead of the bare "\* sizeof(uint32_t)" multiplication.

Please take another look when you get a chance.

-- 
View it on GitLab: 
https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1280#note_152167
You're receiving this email because of your account on gitlab.rtems.org.


_______________________________________________
bugs mailing list
[email protected]
http://lists.rtems.org/mailman/listinfo/bugs

Reply via email to