[PATCH 4/7] kvm tools: fix warnings in virtio-blk

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

 



Fix up warnings related to not checking return value of read/write by actually
handling errors there.

Signed-off-by: Sasha Levin <levinsasha928@xxxxxxxxx>
---
 tools/kvm/virtio/blk.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/virtio/blk.c b/tools/kvm/virtio/blk.c
index 740442a..d988365 100644
--- a/tools/kvm/virtio/blk.c
+++ b/tools/kvm/virtio/blk.c
@@ -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;
 }
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux