path: root/stat.h
diff options
authorSitsofe Wheeler <>2016-11-20 20:55:06 +0000
committerSitsofe Wheeler <>2016-11-27 21:30:15 +0000
commit90eff1c9f01d2f8b4ff8bc75a2bf120a1789b37c (patch)
treeea9d25c549c79f5d2d88137e9dbd73a382270c7d /stat.h
parent42f1ee68ceec87fbbfdc4972c35d3cdf7c08d9f6 (diff)
fio: Fix (unsigned) integer overflow issues
This patch tries to address issues found when compiling fio with clang's undefined behaviour sanitizer on 32 bit Linux. While this generated many false positives it did identify a number of subtle issues when rates/amounts/time calculations went above 32 bit values. The following job was used: [global] time_based runtime=180m bs=256k rw=randrw norandommap rate=512M ioengine=null direct=1 iodepth=8 thread numjobs=10 ramp_time=20m [null] size=1P It should fix because various 32 bit ETA variables were overflowing due to the microsecond arithmetic being done on them (even on 64 bit systems). This patch should also fix and because 64 bit Windows is a LLP64 platform so ints and longs still default to 32 bits. Signed-off-by: Sitsofe Wheeler <>
Diffstat (limited to 'stat.h')
1 files changed, 2 insertions, 2 deletions
diff --git a/stat.h b/stat.h
index e6f77599..de5c12a5 100644
--- a/stat.h
+++ b/stat.h
@@ -224,9 +224,9 @@ struct jobs_eta {
uint32_t files_open;
- uint32_t m_rate[DDIR_RWDIR_CNT], t_rate[DDIR_RWDIR_CNT];
+ uint64_t m_rate[DDIR_RWDIR_CNT], t_rate[DDIR_RWDIR_CNT];
uint32_t m_iops[DDIR_RWDIR_CNT], t_iops[DDIR_RWDIR_CNT];
- uint32_t rate[DDIR_RWDIR_CNT];
+ uint64_t rate[DDIR_RWDIR_CNT];
uint32_t iops[DDIR_RWDIR_CNT];
uint64_t elapsed_sec;
uint64_t eta_sec;