diff options
author | Amit Shah <amit.shah@redhat.com> | 2010-02-12 00:02:14 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2010-02-23 22:52:29 -0500 |
commit | 3b8706240ee6084ccb46e53cd3a554356b7eeec8 (patch) | |
tree | 213051dfce6ddf5eb09d89ead56214372d200338 /drivers/virtio | |
parent | c021eac4148c16bf53baa0dd14e8ebee6f39dab5 (diff) |
virtio: Initialize vq->data entries to NULL
vq operations depend on vq->data[i] being NULL to figure out if the vq
entry is in use (since the previous patch).
We have to initialize them to NULL to ensure we don't work with junk
data and trigger false BUG_ONs.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Shirley Ma <xma@us.ibm.com>
Diffstat (limited to 'drivers/virtio')
-rw-r--r-- | drivers/virtio/virtio_ring.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 782b7292a3d8..0db906b3c95d 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c | |||
@@ -448,8 +448,11 @@ struct virtqueue *vring_new_virtqueue(unsigned int num, | |||
448 | /* Put everything in free lists. */ | 448 | /* Put everything in free lists. */ |
449 | vq->num_free = num; | 449 | vq->num_free = num; |
450 | vq->free_head = 0; | 450 | vq->free_head = 0; |
451 | for (i = 0; i < num-1; i++) | 451 | for (i = 0; i < num-1; i++) { |
452 | vq->vring.desc[i].next = i+1; | 452 | vq->vring.desc[i].next = i+1; |
453 | vq->data[i] = NULL; | ||
454 | } | ||
455 | vq->data[i] = NULL; | ||
453 | 456 | ||
454 | return &vq->vq; | 457 | return &vq->vq; |
455 | } | 458 | } |