Kaben123 opened a new pull request, #22577:
URL: https://github.com/apache/nuttx/pull/22577

   ## Summary
   
   MISRA C-2012 Rule 10.3/10.4 fixes in `mm/mempool` (essential type model):
   
   1. `mempool_multiple_get_dict()`, `mempool_multiple_free()`,
      `mempool_read()`: cast pointer differences to `size_t` before comparing
      with / taking the modulus of unsigned sizes; cast `totalsize` to `off_t`
      when adding to `f_pos`.
   2. `mempool_multiple.c`: use unsigned constants with unsigned operands and
      make the loop index `i` a `size_t` (it is compared with the `size_t`
      `npools`). With `size_t i`, the error path `while (--i >= 0)` in
      `mempool_multiple_init()` would never terminate, so it is changed to
      `while (i-- > 0u)`, which deinitializes the same pools.
   3. `mempool_multiple_alloc_size()`: cast `blocksize` to the `ssize_t` return
      type.
   
   ## Impact
   
   No functional change intended. No API or Kconfig change.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 x86_64, GCC 13.1.0, arm-none-eabi-gcc 13.2.1. Base: 
apache/nuttx master 75b4dc85275, apache/nuttx-apps master 9a2c68962.
   
   - Builds without new warnings, Make: `sim:nsh`, `stm32f4discovery:nsh`;
     CMake: `sim:nsh`.
   - `sim:ostest` with `CONFIG_MM_HEAP_MEMPOOL_THRESHOLD=256` (multiple mempool 
in
     the heap): same result as master, no new failures.
   - `tools/checkpatch.sh -c -u -m -g` passes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to