This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new ee052a4570b mempool:fix bug, Misjudged the condition of interrupt
memory release
ee052a4570b is described below
commit ee052a4570b537346480b9c45be7a3fb96f1b6c2
Author: anjiahao <[email protected]>
AuthorDate: Thu Nov 21 18:20:41 2024 +0800
mempool:fix bug, Misjudged the condition of interrupt memory release
We don't need to subtract the block size; we only need to determine if it's
within the interrupt memory range.
Signed-off-by: anjiahao <[email protected]>
---
mm/mempool/mempool.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c
index 2f1ecd5c0a9..49652fd6f5c 100644
--- a/mm/mempool/mempool.c
+++ b/mm/mempool/mempool.c
@@ -435,7 +435,6 @@ retry:
void mempool_release(FAR struct mempool_s *pool, FAR void *blk)
{
irqstate_t flags = spin_lock_irqsave(&pool->lock);
- size_t blocksize = MEMPOOL_REALBLOCKSIZE(pool);
#if CONFIG_MM_BACKTRACE >= 0
FAR struct mempool_backtrace_s *buf =
(FAR struct mempool_backtrace_s *)((FAR char *)blk + pool->blocksize);
@@ -453,10 +452,10 @@ void mempool_release(FAR struct mempool_s *pool, FAR void
*blk)
memset(blk, MM_FREE_MAGIC, pool->blocksize);
#endif
- if (pool->interruptsize > blocksize)
+ if (pool->ibase)
{
if ((FAR char *)blk >= pool->ibase &&
- (FAR char *)blk < pool->ibase + pool->interruptsize - blocksize)
+ (FAR char *)blk < pool->ibase + pool->interruptsize)
{
sq_addlast(blk, &pool->iqueue);
}