When disk is a cdrom and the drive is empty the "params" node in xenstore might be missing completely: cope with it instead of segfaulting.
Signed-off-by: Stefano Stabellini <stefano.stabell...@eu.citrix.com> diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 134ac33..e553c4c 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -577,12 +577,13 @@ static int blk_init(struct XenDevice *xendev) { struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int index, qflags, have_barriers, info = 0; - char *h; + char *h = NULL; /* read xenstore entries */ if (blkdev->params == NULL) { blkdev->params = xenstore_read_be_str(&blkdev->xendev, "params"); - h = strchr(blkdev->params, ':'); + if (blkdev->params != NULL) + h = strchr(blkdev->params, ':'); if (h != NULL) { blkdev->fileproto = blkdev->params; blkdev->filename = h+1;