aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-09-14 13:48:17 +0200
committerMichael S. Tsirkin <mst@redhat.com>2010-09-14 16:02:23 +0200
commit6b37c87c96a5b148685e8e6bf09d0aca953cb1a8 (patch)
treed3ffdfbda72347674b720c5fd0c1c4421e19836d /hw
parentb6601141cd2a170dfe773987b06f716a190ea7e0 (diff)
downloadqemu-6b37c87c96a5b148685e8e6bf09d0aca953cb1a8.zip
qemu-6b37c87c96a5b148685e8e6bf09d0aca953cb1a8.tar.gz
qemu-6b37c87c96a5b148685e8e6bf09d0aca953cb1a8.tar.bz2
vhost: fix infinite loop on error path
file.index is unsigned, hence 'while (--file.index >= 0)' will loop > forever. Change to while (file.index-- > 0). Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/vhost_net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 4a7b819..c068be1 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -151,7 +151,7 @@ int vhost_net_start(struct vhost_net *net,
return 0;
fail:
file.fd = -1;
- while (--file.index >= 0) {
+ while (file.index-- > 0) {
int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file);
assert(r >= 0);
}