RTEMS | cpukit/libblock: Fixes off-by-1 and memory in flashdisk (!912)
Gedare Bloom (@gedare)
gitlab at rtems.org
Wed Apr 1 19:01:04 UTC 2026
Gedare Bloom started a new discussion on cpukit/libblock/src/flashdisk.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_147856
> + free( fd->devices );
> + fd->devices = NULL;
> + }
> +
> + free( fd->blocks );
> + fd->blocks = NULL;
> +
> + free( fd->copy_buffer );
> + fd->copy_buffer = NULL;
> +}
> +
> +static void rtems_fdisk_cleanup( rtems_flashdisk *base, uint32_t count )
> +{
> + rtems_flashdisk *base_fd = base;
> + for( uint32_t i = count+1; i>0; i-- ) {
> + rtems_fdisk_cleanup_helper( &base[i-1] );
I would probably just use `int i = count; i >= 0; i--` and `base[i]`
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/912#note_147856
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260401/2a0efae7/attachment-0001.htm>
More information about the bugs
mailing list