libc/nmalloc: Handle size_t overflows in posix_memalign().
authorzrj <rimvydas.jasinskas@gmail.com>
Sun, 17 Dec 2017 15:54:01 +0000 (17:54 +0200)
committerzrj <zrj@dragonflybsd.org>
Mon, 18 Dec 2017 16:47:17 +0000 (18:47 +0200)
commite9586122ca8be1e743aa9cd2f9622dfe2f434ece
tree2a321d82514160bd71ed832782fe15ad7408de0e
parent26de45f41c5fd41dd41a869925881a239c05d82a
libc/nmalloc: Handle size_t overflows in posix_memalign().

Some algorithms/programs try to heuristically deduce alignment rules.
Instead of confusing them with minimal allocations for size == (size_t)-7 and
friends at different alignment values, just return ENOMEM since POSIX does not
explictly specify how alignment overflows should behave. Programs should keep
track of pointers they try to allocate (including size == 0 case too).
lib/libc/stdlib/nmalloc.c