From: Ian Campbell Date: Wed, 28 Sep 2011 15:31:11 +0000 (+0100) Subject: libxl: fail to parse disk vpath if a disk+part number needed but unavailable X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~9857 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8ca0ed2cde1176af5adc1c49dc4c14c480f41cbf;p=xen.git libxl: fail to parse disk vpath if a disk+part number needed but unavailable libxl__device_disk_dev_number() can parse a virtpath which is an encoded unsigned long but does not set *pdisk or *ppartition in that case. Ideally we would parse the number but for now simply fail to prevent cascading failures. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 7931b11abc..124ea4cd70 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -341,8 +341,12 @@ int libxl__device_disk_dev_number(const char *virtpath, int *pdisk, errno = 0; ul = strtoul(virtpath, &ep, 0); - if (!errno && !*ep && ul <= INT_MAX) + if (!errno && !*ep && ul <= INT_MAX) { + /* FIXME: should parse ul to determine these. */ + if (pdisk || ppartition) + return -1; return ul; + } if (device_virtdisk_matches(virtpath, "hd", &disk, 3,