]> xenbits.xensource.com Git - xen.git/commit
libxc: Check there's enough memory for segments we're creating
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:46:01 +0000 (09:46 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 3 Feb 2010 09:46:01 +0000 (09:46 +0000)
commitafe765651db2e8f99af74bb8da2a29ee5d923aa6
treee9fb394a900ad8e591d21cadde5a48571208a514
parent91e172bf6bc82d0f26564d545ef181d0d18ae1af
libxc: Check there's enough memory for segments we're creating

Previously, xc_dom_alloc_segment would go ahead even if the segment
we're trying to create is too big for the domain's RAM (or the
requested addr is out of range).  It would pass invalid parameters to
xc_dom_seg_to_ptr giving undefined behaviour.

Fixing xc_dom_seg_to_ptr to fail is not sufficient because we want to
provide a comprehensible explanation to the caller - which may
ultimately be the user.

In particular, with this change attempting "xl create" with a ramdisk
image bigger than the guest's specified RAM will provide a useful
error message mentioning the ramdisk.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_dom_core.c