Skip to contentSkip to conversation

libxenlight: fix two memory related issues

PATCH New Stefano Stabellini 1 participant 1 message Dec 9, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxenlight: fix two memory related issues

Hi all,
this patch fixes two memory related issues in libxenlight:

- LIBXL_MAXMEM_CONSTANT is 1MB but must be expressed in KB;

- xc_dom_linux_build should take target_memkb instead of max_memkb as an argument.

Thanks to Andres for spotting the latter.

---

tools/libxl/libxl_dom.c +1 -1
diff -r d181cdf0244c tools/libxl/libxl_dom.c
@@ -130,7 +130,7 @@
         XL_LOG_ERRNO(ctx, XL_LOG_ERROR, "xc_dom_allocate failed");
         return -1;
     }
-    if ((ret = xc_dom_linux_build(ctx->xch, dom, domid, info->max_memkb / 1024,
+    if ((ret = xc_dom_linux_build(ctx->xch, dom, domid, info->target_memkb / 1024,
                                   info->kernel, info->u.pv.ramdisk, flags,
                                   state->store_port, &state->store_mfn,
                                   state->console_port, &state->console_mfn)) != 0) {
tools/libxl/libxl_internal.h +1 -1
diff -r d181cdf0244c tools/libxl/libxl_internal.h
@@ -31,7 +31,7 @@
 #define LIBXL_DEVICE_MODEL_START_TIMEOUT 10
 #define LIBXL_XENCONSOLE_LIMIT 1048576
 #define LIBXL_XENCONSOLE_PROTOCOL "vt100"
-#define LIBXL_MAXMEM_CONSTANT (1 * 1024 * 1024)
+#define LIBXL_MAXMEM_CONSTANT 1024
 #define QEMU_SIGNATURE "QemuDeviceModelRecord"
 
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))