Skip to contentSkip to conversation

xen: unitialised return value in xenbus_write_transaction

PATCH Applied Ian Campbell 2 participants 2 messages Jan 24, 2009 – Jan 26, 2009 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: unitialised return value in xenbus_write_transaction

The return value of xenbus_write_transaction can be uninitialised in the success case leading to the userspace xenstore utilities failing.

Cc Adam Wendt <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 drivers/xen/xenfs/xenbus.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/xen/xenfs/xenbus.c +5 -6
diff -r 7c66d3ac6805 -r 03f51a1eb4a7 drivers/xen/xenfs/xenbus.c
@@ -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);
Applied
#1 lore raw
Quoted 11 lines · Ian Campbell

The return value of xenbus_write_transaction can be uninitialised in the success case leading to the userspace xenstore utilities failing.

Cc Adam Wendt <[email protected]>
Cc Jeremy Fitzhardinge <[email protected]>
Cc Ingo Molnar <[email protected]>
---
 drivers/xen/xenfs/xenbus.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

applied to tip/x86/urgent, thanks Ian!

Ingo