[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 1/4] libxc/xc_linux_osdep.c: Fix return handling for case of mmap failure
From: Harry Hart <hhart@xxxxxxxxxxx> Callers expect NULL on errors not MAP_FAILED. Signed-off-by: Harry Hart <hhart@xxxxxxxxxxx> Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx> --- tools/libxc/xc_linux_osdep.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/libxc/xc_linux_osdep.c b/tools/libxc/xc_linux_osdep.c index 86bff3e..9745feb 100644 --- a/tools/libxc/xc_linux_osdep.c +++ b/tools/libxc/xc_linux_osdep.c @@ -102,6 +102,11 @@ static void *linux_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_ha return NULL; } + if (p == MAP_FAILED) { + PERROR ("linux_privcmd_alloc_hypercall_buffer: mmap failed"); + return NULL; + } + /* Do not copy the VMA to child process on fork. Avoid the page being COW on hypercall. */ rc = madvise(p, npages * XC_PAGE_SIZE, MADV_DONTFORK); -- 1.8.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |