All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/1] Fix loop logic in vhost_net_start()'s error path
@ 2010-09-14 10:06 Jes.Sorensen
  2010-09-14 11:52 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Jes.Sorensen @ 2010-09-14 10:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex.Williamson, mst

From: Jes Sorensen <Jes.Sorensen@redhat.com>

file.index is unsigned, hence 'while (--file.index >= 0)' will loop
forever. Change it to do {} while (file.index-- > 0)

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 hw/vhost_net.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 4a7b819..b1f8072 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -151,10 +151,10 @@ int vhost_net_start(struct vhost_net *net,
     return 0;
 fail:
     file.fd = -1;
-    while (--file.index >= 0) {
+    do {
         int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
         assert(r >= 0);
-    }
+    } while (file.index-- > 0);
     net->vc->info->poll(net->vc, true);
     vhost_dev_stop(&net->dev, dev);
     if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) {
-- 
1.7.2.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-09-14 11:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-14 10:06 [Qemu-devel] [PATCH 1/1] Fix loop logic in vhost_net_start()'s error path Jes.Sorensen
2010-09-14 11:52 ` [Qemu-devel] " Michael S. Tsirkin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.