RTEMS | cpukit/dev/flash: Fix region bitmap clear size (!1280)

Chris Johns (@chris) gitlab at rtems.org
Wed Jun 3 04:16:52 UTC 2026




Chris Johns started a new discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1280#note_151629


The does not look correct to me and the existing code looks OK.

The macro `RTEMS_FLASHDEV_BITALLOC_LENGTH` has `RTEMS_FLASHDEV_REGION_BITALLOC_LENGTH` bits per word defined as:

```
#define RTEMS_FLASHDEV_REGION_BITALLOC_LENGTH 32
```

so the length of memory in words is:

```
#define RTEMS_FLASHDEV_BITALLOC_LENGTH( t ) \
  ( t->max_regions / RTEMS_FLASHDEV_REGION_BITALLOC_LENGTH )
```

and the memory clear is:

```
  alloc_array_len = RTEMS_FLASHDEV_BITALLOC_LENGTH( table ) +
                    ( ( RTEMS_FLASHDEV_BITALLOC_FINAL_BITS( table ) ) != 0 );

  memset( table->bit_allocator, 0, alloc_array_len );
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1280#note_151629
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/20260603/6135bde6/attachment.htm>


More information about the bugs mailing list