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

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


  • To: <xen-devel@xxxxxxxxxxxxx>
  • From: Tim Deegan <tim@xxxxxxx>
  • Date: Thu, 14 Feb 2013 16:16:33 +0000
  • Delivery-date: Thu, 14 Feb 2013 16:17:03 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

# HG changeset patch
# User Tim Deegan <tim@xxxxxxx>
# Date 1360858577 0
# Node ID 68308aac7872c07631cb8424367907a11811ec3d
# Parent  5a84cc531072378e6e5ff89b4c0e9a35000dc56f
xen/xenoprof: avoid division by 0.

Signed-off-by: Tim Deegan <tim@xxxxxxx>

diff -r 5a84cc531072 -r 68308aac7872 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 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;

_______________________________________________
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®.