In article <26375.1552584...@jinx.noi.kre.to>,
Robert Elz  <k...@munnari.oz.au> wrote:
>

Great debugging :-)

LGTM, at this point I'd merge them:

static int
round_and_check(const struct vm_map *map, vaddr_t *addr, vsize_t *size)
{
        const vsize_t pageoff = (vsize_t)(*addr & PAGE_MASK);

        *addr -= pageoff;

        if (*size != 0) {
                *size += pageoff;
                *size = (vsize_t)round_page(*size);
        }

        if (*addr + *size < *addr)
                return ENOMEM;

        // Make range_test() take const map as it should have in the first place
        return range_test(map, *addr, *size, false);
}


christos

Reply via email to