the following proposed patch for stable (3.0 and 3.1) removes a floating cast
and the use of an uninitialized buffer which could result in high cpu_speed
values when the size of the buffer used by the call to sysctlbyname on
"machdep.tsc.freq" was smaller than the one proposed (8 bytes).

attached original fix committed as r1293

Carlo

---
Index: metrics.c
===================================================================
--- metrics.c   (revision 1292)
+++ metrics.c   (revision 1293)
@@ -204,9 +204,10 @@
     * machdep.tsc_freq exists on some i386/amd64 machines and gives the
     * CPU speed in Hz.  If it exists it's a decent value.
     */
+   tscfreq = 0;
    len = sizeof(tscfreq);
    if (sysctlbyname("machdep.tsc_freq", &tscfreq, &len, NULL, 0) != -1) {
-      freq = (double)tscfreq / 1e6;
+      freq = tscfreq / 1e6;
       goto done;
    }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Ganglia-developers mailing list
Ganglia-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ganglia-developers

Reply via email to