[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] perf counters: Fix NULL-pointer check. Should happen later.



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxxx
# Node ID 3d347263e5d8a5496498a46ddb1662b49bbb016c
# Parent  ee140fbcb88df2e55259b0c6519de7645641468a
[XEN] perf counters: Fix NULL-pointer check. Should happen later.
Signed-of-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>
---
 xen/common/perfc.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff -r ee140fbcb88d -r 3d347263e5d8 xen/common/perfc.c
--- a/xen/common/perfc.c        Fri Oct 27 18:02:40 2006 +0100
+++ b/xen/common/perfc.c        Fri Oct 27 18:10:37 2006 +0100
@@ -143,9 +143,6 @@ static int perfc_copy_info(XEN_GUEST_HAN
     unsigned int v = 0;
     atomic_t *counters = (atomic_t *)&perfcounters;
 
-    if ( guest_handle_is_null(desc) )
-        return 0;
-
     /* We only copy the name and array-size information once. */
     if ( !perfc_init ) 
     {
@@ -175,7 +172,11 @@ static int perfc_copy_info(XEN_GUEST_HAN
         perfc_vals = xmalloc_array(xen_sysctl_perfc_val_t, perfc_nbr_vals);
         perfc_init = 1;
     }
-    if (perfc_vals == NULL)
+
+    if ( guest_handle_is_null(desc) )
+        return 0;
+
+    if ( perfc_vals == NULL )
         return -ENOMEM;
 
     /* Architecture may fill counters from hardware.  */
@@ -207,9 +208,9 @@ static int perfc_copy_info(XEN_GUEST_HAN
     }
     BUG_ON(v != perfc_nbr_vals);
 
-    if (copy_to_guest(desc, (xen_sysctl_perfc_desc_t *)perfc_d, NR_PERFCTRS))
+    if ( copy_to_guest(desc, (xen_sysctl_perfc_desc_t *)perfc_d, NR_PERFCTRS) )
         return -EFAULT;
-    if (copy_to_guest(val, perfc_vals, perfc_nbr_vals))
+    if ( copy_to_guest(val, perfc_vals, perfc_nbr_vals) )
         return -EFAULT;
     return 0;
 }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.