lib/genalloc.c: fix overflow of ending address of memory chunk