[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 17:16, Tim Deegan <tim@xxxxxxx> wrote: > --- a/xen/common/xenoprof.c Thu Feb 14 15:46:56 2013 +0000 > +++ b/xen/common/xenoprof.c Thu Feb 14 16:16:17 2013 +0000 > @@ -225,7 +225,7 @@ static int alloc_xenoprof_struct( > #endif > > /* reduce max_samples if necessary to limit pages allocated */ > - max_bufsize = (MAX_OPROF_SHARED_PAGES * PAGE_SIZE) / nvcpu; > + max_bufsize = (MAX_OPROF_SHARED_PAGES * PAGE_SIZE) / (nvcpu ?: 1); > max_max_samples = ( (max_bufsize - bufsize) / i ) + 1; > if ( (unsigned)max_samples > max_max_samples ) > max_samples = max_max_samples; I think the function would better return an error in that case. After all there's little point in setting up anything when we for sure don't know how many vCPU-s a domain is going to have. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |