diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2007-11-07 16:49:24 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-11-11 21:59:09 -0500 |
commit | 1bc4953ed44454c7f53d0b609445d1534981ee75 (patch) | |
tree | 05f67206d6978261ad2569d3a0030f0299331191 /drivers/virtio | |
parent | 4d125de3a5d130054df2285e542c1491d214d3e8 (diff) |
virtio: Fix used_idx wrap-around
The more_used() function compares the vq->vring.used->idx with last_used_idx.
Since vq->vring.used->idx is a 16-bit integer, and last_used_idx is an
unsigned int, this results in unpredictable behavior when vq->vring.used->idx
wraps around.
This patch corrects this by changing last_used_idx to the correct type.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0e4baca21b8f..0e1bf053d8cd 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -53,7 +53,7 @@ struct vring_virtqueue | |||
53 | unsigned int num_added; | 53 | unsigned int num_added; |
54 | 54 | ||
55 | /* Last used index we've seen. */ | 55 | /* Last used index we've seen. */ |
56 | unsigned int last_used_idx; | 56 | u16 last_used_idx; |
57 | 57 | ||
58 | /* How to notify other side. FIXME: commonalize hcalls! */ | 58 | /* How to notify other side. FIXME: commonalize hcalls! */ |
59 | void (*notify)(struct virtqueue *vq); | 59 | void (*notify)(struct virtqueue *vq); |