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-changelog

[Xen-changelog] [xen-unstable] [ACM] Don't use uninitialised struct valu

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [ACM] Don't use uninitialised struct value if hypercall fails.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 23 Oct 2006 11:50:13 +0000
Delivery-date: Mon, 23 Oct 2006 04:50:18 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID da5997fcc0702c8e31fa4d8fcd034c5a9cb3ab8d
# Parent  e292f0df2d96c4e72b6cdbcf09c567ef3f3cfdc1
[ACM] Don't use uninitialised struct value if hypercall fails.
From: Jan Beulich <jbeulich@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 tools/python/xen/lowlevel/acm/acm.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff -r e292f0df2d96 -r da5997fcc070 tools/python/xen/lowlevel/acm/acm.c
--- a/tools/python/xen/lowlevel/acm/acm.c       Mon Oct 23 09:52:51 2006 +0100
+++ b/tools/python/xen/lowlevel/acm/acm.c       Mon Oct 23 09:57:24 2006 +0100
@@ -147,9 +147,10 @@ static PyObject *getdecision(PyObject * 
 {
     char *arg1_name, *arg1, *arg2_name, *arg2, *decision = NULL;
     struct acm_getdecision getdecision;
-    int xc_handle;
-
-    if (!PyArg_ParseTuple(args, "ssss", &arg1_name, &arg1, &arg2_name, &arg2)) 
{
+    int xc_handle, rc;
+
+    if (!PyArg_ParseTuple(args, "ssss", &arg1_name,
+                          &arg1, &arg2_name, &arg2)) {
         return NULL;
     }
 
@@ -179,12 +180,16 @@ static PyObject *getdecision(PyObject * 
         getdecision.id2.ssidref = atol(arg2);
     }
 
-    if (xc_acm_op(xc_handle, ACMOP_getdecision, &getdecision, 
sizeof(getdecision)) < 0) {
+    rc = xc_acm_op(xc_handle, ACMOP_getdecision,
+                   &getdecision, sizeof(getdecision));
+
+    xc_interface_close(xc_handle);
+
+    if (rc < 0) {
         if (errno == EACCES)
             PERROR("ACM operation failed.");
-    }
-
-    xc_interface_close(xc_handle);
+        return NULL;
+    }
 
     if (getdecision.acm_decision == ACM_ACCESS_PERMITTED)
         decision = "PERMITTED";

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [ACM] Don't use uninitialised struct value if hypercall fails., Xen patchbot-unstable <=