Skip to content

Commit

Permalink
lguest: Fix uninitialized members in example launcher
Browse files Browse the repository at this point in the history
Thanks valgrind!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Nov 19, 2007
1 parent 2ffbb83 commit d1c856e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,11 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
/ getpagesize();
p = get_pages(pages);

/* Initialize the virtqueue */
vq->next = NULL;
vq->last_avail_idx = 0;
vq->dev = dev;

/* Initialize the configuration. */
vq->config.num = num_descs;
vq->config.irq = devices.next_irq++;
Expand All @@ -1057,9 +1062,6 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
for (i = &dev->vq; *i; i = &(*i)->next);
*i = vq;

/* Link virtqueue back to device. */
vq->dev = dev;

/* Set the routine to call when the Guest does something to this
* virtqueue. */
vq->handle_output = handle_output;
Expand Down Expand Up @@ -1093,6 +1095,7 @@ static struct device *new_device(const char *name, u16 type, int fd,
dev->desc = new_dev_desc(type);
dev->handle_input = handle_input;
dev->name = name;
dev->vq = NULL;
return dev;
}

Expand Down

0 comments on commit d1c856e

Please sign in to comment.