[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] xen/xenoprof: avoid division by 0



>>> On 14.02.13 at 18:10, Tim Deegan <tim@xxxxxxx> wrote:
> # HG changeset patch
> # Parent 5a84cc531072378e6e5ff89b4c0e9a35000dc56f
> xen/xenoprof: avoid division by 0.
> 
> Signed-off-by: Tim Deegan <tim@xxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>

> 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@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.