[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.1] xenoprof: avoid division by 0
commit c705547372325f22dcc8757d63d6d8494edf53ab Author: Tim Deegan <tim@xxxxxxx> AuthorDate: Fri Feb 22 13:58:04 2013 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Feb 22 13:58:04 2013 +0100 xenoprof: avoid division by 0 Signed-off-by: Tim Deegan <tim@xxxxxxx> Acked-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Keir Fraser <keir@xxxxxxx> master changeset: 085f1f2d3aee1a35dfc7ca2f4423e51fa654010c master date: 2013-02-15 09:42:02 +0100 --- 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 ea4ebf1..6d34418 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 -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.1 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |