From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH] xen/xenoprof: avoid division by 0 Date: Fri, 15 Feb 2013 08:24:15 +0000 Message-ID: References: <511DFB6F02000078000BE94E@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <511DFB6F02000078000BE94E@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , Tim Deegan Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 15/02/2013 08:10, "Jan Beulich" wrote: >>>> On 14.02.13 at 18:10, Tim Deegan wrote: >> # HG changeset patch >> # Parent 5a84cc531072378e6e5ff89b4c0e9a35000dc56f >> xen/xenoprof: avoid division by 0. >> >> Signed-off-by: Tim Deegan > > Acked-by: Jan Beulich Acked-by: Keir Fraser >> diff -r 5a84cc531072 xen/common/xenoprof.c >> --- a/xen/common/xenoprof.c Thu Feb 14 15:46:56 2013 +0000 >> +++ b/xen/common/xenoprof.c Thu Feb 14 17:07:41 2013 +0000 >> @@ -193,6 +193,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 = xzalloc(struct xenoprof); >> if ( d->xenoprof == NULL ) >> { >> @@ -209,10 +216,6 @@ static int alloc_xenoprof_struct( >> return -ENOMEM; >> } >> >> - nvcpu = 0; >> - for_each_vcpu ( d, v ) >> - nvcpu++; >> - >> bufsize = sizeof(struct xenoprof_buf); >> i = sizeof(struct event_log); >> #ifdef CONFIG_COMPAT > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel