All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.com>
To: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>,
	Vincent Hanquez <vincent.hanquez@eu.citrix.com>,
	xen-devel@lists.xensource.com
Subject: [PATCH 4/7] libxenlight resend: avoid writing empty values to xenstore
Date: Wed, 02 Dec 2009 13:01:42 -0500	[thread overview]
Message-ID: <4B16AB86.5040306@lagarcavilla.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 313 bytes --]

This is not a resend strictly speaking, rather an extension of a patch 
accepted previously

-------------------------------

Prevent segmentation fault caused by empty values
in key-value pairs for the /vm/ subdirectory
when restoring a pv domain.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>


[-- Attachment #2: 04_avoid_segfault_empty_vm_values.patch --]
[-- Type: text/plain, Size: 1768 bytes --]

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.com>
# Date 1259765969 18000
# Node ID 3d56de009e4233b872a147db8b100cec22dfcfaf
# Parent  2cb7689c60c959f9d9aa29ce5d285486c5a011df
Prevent segmentation fault caused by empty values
in key-value pairs for the /vm/ subdirectory
when restoring a pv domain.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.com>

diff -r 2cb7689c60c9 -r 3d56de009e42 libxl.c
--- a/libxl.c
+++ b/libxl.c
@@ -229,6 +229,7 @@ int libxl_domain_restore(struct libxl_ct
                          libxl_device_model_info *dm_info)
 {
     char **vments = NULL, **localents = NULL;
+    int i;
 
     build_pre(ctx, domid, info, state);
     restore_common(ctx, domid, info, state, fd);
@@ -240,14 +241,19 @@ int libxl_domain_restore(struct libxl_ct
         vments[3] = "hvm";
     } else {
         vments = libxl_calloc(ctx, 9, sizeof(char *));
-        vments[0] = "image/ostype";
-        vments[1] = "linux";
-        vments[2] = "image/kernel";
-        vments[3] = (char*) info->kernel;
-        vments[4] = "image/ramdisk";
-        vments[5] = (char*) info->u.pv.ramdisk;
-        vments[6] = "image/cmdline";
-        vments[7] = (char*) info->u.pv.cmdline;
+        i = 0;
+        vments[i++] = "image/ostype";
+        vments[i++] = "linux";
+        vments[i++] = "image/kernel";
+        vments[i++] = (char*) info->kernel;
+        if (info->u.pv.ramdisk) {
+            vments[i++] = "image/ramdisk";
+            vments[i++] = (char*) info->u.pv.ramdisk;
+        }
+        if (info->u.pv.cmdline) {
+            vments[i++] = "image/cmdline";
+            vments[i++] = (char*) info->u.pv.cmdline;
+        }
     }
     build_post(ctx, domid, info, state, vments, localents);
     if (info->hvm)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

             reply	other threads:[~2009-12-02 18:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02 18:01 Andres Lagar-Cavilla [this message]
2009-12-03 12:35 ` [PATCH 4/7] libxenlight resend: avoid writing empty values to xenstore Stefano Stabellini
2009-12-03 17:06 ` [PATCH 4/7] libxenlight meta-resend: " Andres Lagar-Cavilla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B16AB86.5040306@lagarcavilla.com \
    --to=andres@lagarcavilla.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=vincent.hanquez@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.