mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
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 <anjiahao@xiaomi.com>
This commit is contained in:
@@ -428,7 +428,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);
|
||||
@@ -446,10 +445,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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user