diff options
author | kaf24@localhost.localdomain <kaf24@localhost.localdomain> | 2006-10-27 18:10:37 +0100 |
---|---|---|
committer | kaf24@localhost.localdomain <kaf24@localhost.localdomain> | 2006-10-27 18:10:37 +0100 |
commit | 98781cd038ae920c06f7ba8ee0a2986b104e5a4d (patch) | |
tree | 1502a50b9f0f10871a54f5e867cee07c64dca3e0 /xen/common/perfc.c | |
parent | 0fd9a9f411de32dff4a6a51d5632ba6faea4996c (diff) | |
download | xen-98781cd038ae920c06f7ba8ee0a2986b104e5a4d.tar.gz xen-98781cd038ae920c06f7ba8ee0a2986b104e5a4d.tar.bz2 xen-98781cd038ae920c06f7ba8ee0a2986b104e5a4d.zip |
[XEN] perf counters: Fix NULL-pointer check. Should happen later.
Signed-of-by: Kouya Shimura <kouya@jp.fujitsu.com>
Diffstat (limited to 'xen/common/perfc.c')
-rw-r--r-- | xen/common/perfc.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 1903ef2f4e..471bd3cd2b 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -143,9 +143,6 @@ static int perfc_copy_info(XEN_GUEST_HANDLE(xen_sysctl_perfc_desc_t) desc, 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_HANDLE(xen_sysctl_perfc_desc_t) desc, 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_HANDLE(xen_sysctl_perfc_desc_t) desc, } 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; } |