projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b660114
)
vhost: fix infinite loop on error path
author
Michael S. Tsirkin
<mst@redhat.com>
Tue, 14 Sep 2010 11:48:17 +0000
(13:48 +0200)
committer
Michael S. Tsirkin
<mst@redhat.com>
Tue, 14 Sep 2010 14:02:23 +0000
(16:02 +0200)
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>
hw/vhost_net.c
patch
|
blob
|
history
diff --git
a/hw/vhost_net.c
b/hw/vhost_net.c
index 4a7b8194f2cdb67d43c22aeb2d900d56d01c6a45..c068be1f54944c26c61d0283a7553da7aae224da 100644
(file)
--- 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);
}