diff options
-rw-r--r-- | xen/common/xenoprof.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index ea4ebf1e16..6d34418bce 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -192,6 +192,13 @@ static int alloc_xenoprof_struct( unsigned max_max_samples; int i; + nvcpu = 0; + for_each_vcpu ( d, v ) + nvcpu++; + + if ( !nvcpu ) + return -EINVAL; + d->xenoprof = xmalloc(struct xenoprof); if ( d->xenoprof == NULL ) @@ -213,10 +220,6 @@ static int alloc_xenoprof_struct( memset(d->xenoprof->vcpu, 0, d->max_vcpus * sizeof(*d->xenoprof->vcpu)); - nvcpu = 0; - for_each_vcpu ( d, v ) - nvcpu++; - bufsize = sizeof(struct xenoprof_buf); i = sizeof(struct event_log); #ifdef CONFIG_COMPAT |