WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxl: Do not SEGV when no 'removable' disk para

To: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxl: Do not SEGV when no 'removable' disk parameter in xenstore
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Wed, 8 Jun 2011 11:50:09 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 08 Jun 2011 03:47:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <b2b8fef3732c10f012fc.1307529705@devel14>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4DEE12D2.3000800@xxxxxxxxxxxx> <b2b8fef3732c10f012fc.1307529705@devel14>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
On Wed, 8 Jun 2011, Marek Marczykowski wrote:
> # HG changeset patch
> # User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
> # Date 1307145395 -7200
> # Node ID b2b8fef3732c10f012fc209d2850e80d95471582
> # Parent  0c0f9e1bd14073b5cb1d4f58b6950d16128003fa
> libxl: Do not SEGV when no 'removable' disk parameter in xenstore
> 
> Just assume disk as not removable when no 'removable' paremeter
> 
> Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
> 

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -1563,6 +1563,7 @@ static unsigned int libxl__append_disk_l
>                               libxl__xs_get_dompath(gc, 0), type, domid);
>      dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
>      if (dir) {
> +        char *removable;
>          *disks = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
>          pdisk = *disks + *ndisks;
>          *ndisks += n;
> @@ -1580,7 +1581,11 @@ static unsigned int libxl__append_disk_l
>                  libxl__sprintf(gc, "%s/%s/type", be_path, *dir)), 
>                  &(pdisk->backend));
>              pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, 
> "%s/%s/dev", be_path, *dir), &len);
> -            pdisk->unpluggable = atoi(libxl__xs_read(gc, XBT_NULL, 
> libxl__sprintf(gc, "%s/%s/removable", be_path, *dir)));
> +            removable = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, 
> "%s/%s/removable", be_path, *dir));
> +            if (removable)
> +                pdisk->unpluggable = atoi(removable);
> +            else
> +                pdisk->unpluggable = 0;
>              if (!strcmp(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, 
> "%s/%s/mode", be_path, *dir)), "w"))
>                  pdisk->readwrite = 1;
>              else
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel
> 

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

<Prev in Thread] Current Thread [Next in Thread>