WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xen: unitialised return value in xenbus_write_transa

To: linux-kernel@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xen: unitialised return value in xenbus_write_transaction
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Sat, 24 Jan 2009 08:22:47 +0000
Cc: Ingo Molnar <mingo@xxxxxxx>, Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>, Adam Wendt <thelsdj@xxxxxxxxx>
Delivery-date: Sat, 24 Jan 2009 00:23:20 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
The return value of xenbus_write_transaction can be uninitialised in
the success case leading to the userspace xenstore utilities failing.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Adam Wendt <thelsdj@xxxxxxxxx>
Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>

---
 drivers/xen/xenfs/xenbus.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff -r 7c66d3ac6805 -r 03f51a1eb4a7 drivers/xen/xenfs/xenbus.c
--- a/drivers/xen/xenfs/xenbus.c        Fri Jan 23 16:42:41 2009 +0000
+++ b/drivers/xen/xenfs/xenbus.c        Fri Jan 23 16:42:41 2009 +0000
@@ -291,7 +291,7 @@
 static int xenbus_write_transaction(unsigned msg_type,
                                    struct xenbus_file_priv *u)
 {
-       int rc, ret;
+       int rc;
        void *reply;
        struct xenbus_transaction_holder *trans = NULL;
        LIST_HEAD(staging_q);
@@ -326,15 +326,14 @@
        }
 
        mutex_lock(&u->reply_mutex);
-       ret = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg));
-       if (!ret)
-               ret = queue_reply(&staging_q, reply, u->u.msg.len);
-       if (!ret) {
+       rc = queue_reply(&staging_q, &u->u.msg, sizeof(u->u.msg));
+       if (!rc)
+               rc = queue_reply(&staging_q, reply, u->u.msg.len);
+       if (!rc) {
                list_splice_tail(&staging_q, &u->read_buffers);
                wake_up(&u->read_waitq);
        } else {
                queue_cleanup(&staging_q);
-               rc = ret;
        }
        mutex_unlock(&u->reply_mutex);
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>