All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: lguest <lguest@ozlabs.org>
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org
Subject: [PATCH] lguest: Fix uninitialized members in example launcher
Date: Mon, 19 Nov 2007 11:10:25 +1100	[thread overview]
Message-ID: <200711191110.25836.rusty@rustcorp.com.au> (raw)

Thanks valgrind!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff -r 1041aeb944b2 Documentation/lguest/lguest.c
--- a/Documentation/lguest/lguest.c	Tue Nov 13 15:11:06 2007 +1100
+++ b/Documentation/lguest/lguest.c	Thu Nov 15 13:28:48 2007 +1100
@@ -1040,6 +1040,11 @@ static void add_virtqueue(struct device 
 		/ 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++;
@@ -1056,9 +1061,6 @@ static void add_virtqueue(struct device 
 	 * second.  */
 	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. */
@@ -1093,6 +1095,7 @@ static struct device *new_device(const c
 	dev->desc = new_dev_desc(type);
 	dev->handle_input = handle_input;
 	dev->name = name;
+	dev->vq = NULL;
 	return dev;
 }
 

             reply	other threads:[~2007-11-19  0:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19  0:10 Rusty Russell [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-11-19  0:10 [PATCH] lguest: Fix uninitialized members in example launcher Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200711191110.25836.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=lguest@ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.