zephyr/include/sys
Nicolas Pitre ace11bbefd mempool: make sure max block size isn't smaller than minimum allowed
If maxsize is smaller than _MPOOL_MINBLK, then Z_MPOOL_LVLS() will be 0.
That means the loop in z_sys_mem_pool_base_init() that initializes the
block free list for the nonexistent level 0 will corrupt whatever memory
at the location the zero-sized struct sys_mem_pool_lvl array was
located. And the corruption happens to be done with a perfectly legit
memory pool block address which makes for really nasty bugs to solve.

This is more likely on 64-bit systems due to _MPOOL_MINBLK being twice
the size of 32-bit systems.

Let's prevent that with a build-time assertion on maxsize when defining
a memory pool, and adjust the affected test accordingly.

Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
2019-07-02 19:41:20 -07:00
..
__assert.h cleanup: include/: move misc/printk.h to sys/printk.h 2019-06-27 22:55:49 -04:00
atomic.h
base64.h
byteorder.h cleanup: include/: move misc/byteorder.h to sys/byteorder.h 2019-06-27 22:55:49 -04:00
crc.h cleanup: include/: move crc.h to sys/crc.h 2019-06-27 22:55:49 -04:00
dlist.h cleanup: include/: move misc/dlist.h to sys/dlist.h 2019-06-27 22:55:49 -04:00
errno_private.h cleanup: include/: move misc/errno_private.h to sys/errno_private.h 2019-06-27 22:55:49 -04:00
fdtable.h cleanup: include/: move misc/fdtable.h to sys/fdtable.h 2019-06-27 22:55:49 -04:00
libc-hooks.h cleanup: include/: move misc/libc-hooks.h to sys/libc-hooks.h 2019-06-27 22:55:49 -04:00
list_gen.h cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
math_extras_impl.h cleanup: include/: move misc/math_extras_impl.h to sys/math_extras_impl.h 2019-06-27 22:55:49 -04:00
math_extras.h cleanup: include/: move misc/math_extras_impl.h to sys/math_extras_impl.h 2019-06-27 22:55:49 -04:00
mempool_base.h mempool: fully use the inline free block bitmap on 64-bit targets 2019-07-02 19:41:20 -07:00
mempool.h mempool: make sure max block size isn't smaller than minimum allowed 2019-07-02 19:41:20 -07:00
mutex.h cleanup: include/: move misc/mutex.h to sys/mutex.h 2019-06-27 22:55:49 -04:00
printk.h cleanup: include/: move misc/printk.h to sys/printk.h 2019-06-27 22:55:49 -04:00
rb.h cleanup: include/: move misc/rb.h to sys/rb.h 2019-06-27 22:55:49 -04:00
ring_buffer.h cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00
sflist.h cleanup: include/: move misc/sflist.h to sys/sflist.h 2019-06-27 22:55:49 -04:00
slist.h cleanup: include/: move misc/slist.h to sys/slist.h 2019-06-27 22:55:49 -04:00
speculation.h cleanup: include/: move misc/speculation.h to sys/speculation.h 2019-06-27 22:55:49 -04:00
sys_io.h cleanup: include/: move sys_io.h to sys/sys_io.h 2019-06-27 22:55:49 -04:00
util.h cleanup: include/: move misc/util.h to sys/util.h 2019-06-27 22:55:49 -04:00