mm/memblock: properly handle overlaps and fix error path