]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: fix warnings in virtio-blk
authorSasha Levin <levinsasha928@gmail.com>
Thu, 30 Aug 2012 07:36:40 +0000 (09:36 +0200)
committerPekka Enberg <penberg@kernel.org>
Fri, 31 Aug 2012 07:12:44 +0000 (10:12 +0300)
Fix up warnings related to not checking return value of read/write by actually
handling errors there.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/virtio/blk.c

index 740442add6ab0d5bd94345d67c453b0fe8364702..d98836577dc78b68fa1f01f37526ce8a212f77b9 100644 (file)
@@ -184,9 +184,12 @@ static void *virtio_blk_thread(void *dev)
 {
        struct blk_dev *bdev = dev;
        u64 data;
+       int r;
 
        while (1) {
-               read(bdev->io_efd, &data, sizeof(u64));
+               r = read(bdev->io_efd, &data, sizeof(u64));
+               if (r < 0)
+                       continue;
                virtio_blk_do_io(bdev->kvm, &bdev->vqs[0], bdev);
        }
 
@@ -198,8 +201,11 @@ static int notify_vq(struct kvm *kvm, void *dev, u32 vq)
 {
        struct blk_dev *bdev = dev;
        u64 data = 1;
+       int r;
 
-       write(bdev->io_efd, &data, sizeof(data));
+       r = write(bdev->io_efd, &data, sizeof(data));
+       if (r < 0)
+               return r;
 
        return 0;
 }