ia64/xen-unstable

changeset 12028:3d347263e5d8

[XEN] perf counters: Fix NULL-pointer check. Should happen later.
Signed-of-by: Kouya Shimura <kouya@jp.fujitsu.com>
author kaf24@localhost.localdomain
date Fri Oct 27 18:10:37 2006 +0100 (2006-10-27)
parents ee140fbcb88d
children 50fa06501e54
files xen/common/perfc.c
line diff
     1.1 --- a/xen/common/perfc.c	Fri Oct 27 18:02:40 2006 +0100
     1.2 +++ b/xen/common/perfc.c	Fri Oct 27 18:10:37 2006 +0100
     1.3 @@ -143,9 +143,6 @@ static int perfc_copy_info(XEN_GUEST_HAN
     1.4      unsigned int v = 0;
     1.5      atomic_t *counters = (atomic_t *)&perfcounters;
     1.6  
     1.7 -    if ( guest_handle_is_null(desc) )
     1.8 -        return 0;
     1.9 -
    1.10      /* We only copy the name and array-size information once. */
    1.11      if ( !perfc_init ) 
    1.12      {
    1.13 @@ -175,7 +172,11 @@ static int perfc_copy_info(XEN_GUEST_HAN
    1.14          perfc_vals = xmalloc_array(xen_sysctl_perfc_val_t, perfc_nbr_vals);
    1.15          perfc_init = 1;
    1.16      }
    1.17 -    if (perfc_vals == NULL)
    1.18 +
    1.19 +    if ( guest_handle_is_null(desc) )
    1.20 +        return 0;
    1.21 +
    1.22 +    if ( perfc_vals == NULL )
    1.23          return -ENOMEM;
    1.24  
    1.25      /* Architecture may fill counters from hardware.  */
    1.26 @@ -207,9 +208,9 @@ static int perfc_copy_info(XEN_GUEST_HAN
    1.27      }
    1.28      BUG_ON(v != perfc_nbr_vals);
    1.29  
    1.30 -    if (copy_to_guest(desc, (xen_sysctl_perfc_desc_t *)perfc_d, NR_PERFCTRS))
    1.31 +    if ( copy_to_guest(desc, (xen_sysctl_perfc_desc_t *)perfc_d, NR_PERFCTRS) )
    1.32          return -EFAULT;
    1.33 -    if (copy_to_guest(val, perfc_vals, perfc_nbr_vals))
    1.34 +    if ( copy_to_guest(val, perfc_vals, perfc_nbr_vals) )
    1.35          return -EFAULT;
    1.36      return 0;
    1.37  }