[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 5/6] ioemu: Fail on too small blktap disks



The blktap infrastructure doesn't seems to be able to cope with images
that are smaller than a sector, it produced hangs for me. Such an
image isn't really useful anyway, so just fail gracefully.

Signed-off-by: Kevin Wolf <kwolf@xxxxxxx>
---
 hw/xen_blktap.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/hw/xen_blktap.c b/hw/xen_blktap.c
index 9cb2a45..f04f30d 100644
--- a/hw/xen_blktap.c
+++ b/hw/xen_blktap.c
@@ -258,6 +258,12 @@ static int open_disk(struct td_state *s, char *path, int 
driver, int readonly)
        s->size = bs->total_sectors;
        s->sector_size = 512;
 
+       if (s->size == 0) {
+               fprintf(stderr, "Error: Disk image %s is too small\n",
+                       path);
+               return -ENOMEM;
+       }
+
        s->info = ((s->flags & TD_RDONLY) ? VDISK_READONLY : 0);
 
 #ifndef QEMU_TOOL
-- 
1.6.0.2


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.