-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Labels
area: KernelbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug
Description
the alignment in mempool is #define _ALIGN4(n) ((((n)+3)/4)*4), it means the alignment might expand the size of the block. If max_sz is not the power of four such as 36, the size of second level is ((((36/4)+3)/4)*4) = 12. Function block_break breaks the big block into 4 small blocks and append the last 3 blocks into the free_list.The last block might overflow the big block because function block_fits can not avoid this overflow. The last small block and the next big block would contain a same memory.
- max_sz = 36, n_max = 3
- alloc a small block (size 12)
- alloc a big block (size 36)
- alloc 3 small block(size 12)
Metadata
Metadata
Assignees
Labels
area: KernelbugThe issue is a bug, or the PR is fixing a bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bugLow impact/importance bug