engines/cpu: fix potential overflow in thinktime calculation
[fio.git] / engines / cpu.c
index 09872508e12129d1408040eadb40055c0ebb8181..4d572b441a54921541e5d7e27ae8151c1dc4a2ce 100644 (file)
@@ -85,7 +85,7 @@ static int fio_cpuio_init(struct thread_data *td)
         */
        o->thinktime_blocks = 1;
        o->thinktime_spin = 0;
-       o->thinktime = (co->cpucycle * (100 - co->cpuload)) / co->cpuload;
+       o->thinktime = ((unsigned long long) co->cpucycle * (100 - co->cpuload)) / co->cpuload;
 
        o->nr_files = o->open_files = 1;