This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 97e93a4af562cfebdb9bd7a332d59fae7eaf5857
Author: makejian <[email protected]>
AuthorDate: Mon Nov 3 22:09:40 2025 +0800

    coverity/mempool: fix mempool_multiple_init type covert from int into size_t
    
    mempool_multiple_init() kept the size of the pool array, a size_t, in
    the int ret.  Use a size_t variable for it.
    
    Assisted-by: Kiro:claude-opus-5-5
    Signed-off-by: makejian <[email protected]>
---
 mm/mempool/mempool_multiple.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/mm/mempool/mempool_multiple.c b/mm/mempool/mempool_multiple.c
index 58c6caf759d..e3691b32dc1 100644
--- a/mm/mempool/mempool_multiple.c
+++ b/mm/mempool/mempool_multiple.c
@@ -405,6 +405,7 @@ mempool_multiple_init(FAR const char *name,
   FAR struct mempool_s *pools;
   size_t maxpoolszie;
   size_t minpoolsize;
+  size_t mempoolsize;
   int ret;
   int i;
 
@@ -428,15 +429,15 @@ mempool_multiple_init(FAR const char *name,
         }
     }
 
-  ret = sizeof(struct mempool_multiple_s) +
-        npools * sizeof(struct mempool_s);
-  mpool = alloc(arg, sizeof(uintptr_t), ret);
+  mempoolsize = sizeof(struct mempool_multiple_s) +
+                npools * sizeof(struct mempool_s);
+  mpool = alloc(arg, sizeof(uintptr_t), mempoolsize);
   if (mpool == NULL)
     {
       return NULL;
     }
 
-  memset(mpool, 0, ret);
+  memset(mpool, 0, mempoolsize);
 
   pools = (FAR struct mempool_s *)
           ((uintptr_t)mpool + sizeof(struct mempool_multiple_s));

Reply via email to