zephyr/lib/os
Nicolas Pitre c227fe7b80 lib/os/heap: Correct aligned_alloc sizing for small heaps
The code that made aligned_alloc work with the 4-byte heap headers was
requesting a block of the correctly padded size, and correctly
aligning the output buffer within that memory, but it was using the
UNALIGNED chunk size for the buffer as the final size of the block
with splitting off the unused suffix.  So the final chunk in the
buffer was could be incorrectly returned to the heap and reused,
leading to overlap.

Compute the chunk size of the output buffer based on the
already-aligned output pointer instead.

Initial investigation and fix from Andy Ross <andrew.j.ross@intel.com>.
I reworked his fix, created a test case, and stolen his commit log.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2020-10-23 12:52:04 -04:00
..
assert.c
base64.c
CMakeLists.txt
crc7_sw.c
crc8_sw.c
crc16_sw.c
crc32_sw.c
dec.c
fdtable.c
heap-validate.c
heap.c lib/os/heap: Correct aligned_alloc sizing for small heaps 2020-10-23 12:52:04 -04:00
heap.h code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
hex.c
json.c misc: Replace assert include and calls by sys/__assert.h equivalent 2020-10-02 11:42:40 +02:00
Kconfig
mempool.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
mutex.c
notify.c
onoff.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
prf.c
printk.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
rb.c
ring_buffer.c
sem.c code-guideline: Fixing code violation 10.4 Rule 2020-10-01 17:13:29 -04:00
thread_entry.c
timeutil.c
work_q.c