Package: powernowd
Version: 0.97-1

I have a system having an uptime of 267 days, where the output of /proc/stat
contains:
cpu0 1007769 1051077 4434830 2292814321 3357918 118001 4420102

Notice that the 5th columns contains a value larger than INT_MAX. This value
has to be converted by using strtoll. The powernowd uses strtol,
making a wrong conversion, resulting in a division by zero somewhere and no
frequency scheduling.

I'd like to propose the following patch:

$ diff -u powernowd.c.orig powernowd.c
--- powernowd.c.orig    2006-10-10 22:23:49.000000000 +0200
+++ powernowd.c 2006-10-10 22:24:17.000000000 +0200
@@ -230,13 +230,13 @@

        memcpy(cpu->last_reading, cpu->reading, sizeof(cpustats_t));

-       cpu->reading->user = strtol(p2, &p2, 10);
-       cpu->reading->mynice = strtol(p2, &p2, 10);
-       cpu->reading->system = strtol(p2, &p2, 10);
-       cpu->reading->idle = strtol(p2, &p2, 10);
-       cpu->reading->iowait = strtol(p2, &p2, 10);
-       cpu->reading->irq = strtol(p2, &p2, 10);
-       cpu->reading->softirq = strtol(p2, &p2, 10);
+       cpu->reading->user = strtoll(p2, &p2, 10);
+       cpu->reading->mynice = strtoll(p2, &p2, 10);
+       cpu->reading->system = strtoll(p2, &p2, 10);
+       cpu->reading->idle = strtoll(p2, &p2, 10);
+       cpu->reading->iowait = strtoll(p2, &p2, 10);
+       cpu->reading->irq = strtoll(p2, &p2, 10);
+       cpu->reading->softirq = strtoll(p2, &p2, 10);

        return 0;
 }


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to