Skip to content

k_mem_pool crash with larger values of n_max #6727

@andrewboie

Description

@andrewboie

Steps to reproduce:

At toplevel declare:
K_MEM_POOL_DEFINE(my_pool, 64, 1024, 61, 4);

Where n_max is 61.

Then somewhere in code:

	struct k_mem_block blk;

	mem = k_mem_pool_alloc(&my_pool, &blk, 1024, 0);

This results in a page fault on x86, on further inspection, the dlist structures in pool->levels are being corrupted:

***** CPU Page Fault (error code 0x00000000)
Supervisor thread read address 0x20000003

If this is not a bug, we need to clearly document what the upper bounds for various parameters to K_MEM_POOL_DEFINE are, and add assertions to enforce them.

Metadata

Metadata

Assignees

Labels

area: KernelbugThe issue is a bug, or the PR is fixing a bugpriority: mediumMedium impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions