summaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorSitsofe Wheeler <sitsofe@yahoo.com>2016-11-20 20:55:06 +0000
committerSitsofe Wheeler <sitsofe@yahoo.com>2016-11-27 21:30:15 +0000
commit90eff1c9f01d2f8b4ff8bc75a2bf120a1789b37c (patch)
treeea9d25c549c79f5d2d88137e9dbd73a382270c7d /server.c
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 https://github.com/axboe/fio/issues/270 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 https://github.com/axboe/fio/issues/194 and https://github.com/axboe/fio/issues/266 because 64 bit Windows is a LLP64 platform so ints and longs still default to 32 bits. Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
Diffstat (limited to 'server.c')
-rw-r--r--server.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/server.c b/server.c
index 091c161..c520b6b 100644
--- a/server.c
+++ b/server.c
@@ -912,11 +912,11 @@ static int handle_send_eta_cmd(struct fio_net_cmd *cmd)
je->files_open = cpu_to_le32(je->files_open);
for (i = 0; i < DDIR_RWDIR_CNT; i++) {
- je->m_rate[i] = cpu_to_le32(je->m_rate[i]);
- je->t_rate[i] = cpu_to_le32(je->t_rate[i]);
+ je->m_rate[i] = cpu_to_le64(je->m_rate[i]);
+ je->t_rate[i] = cpu_to_le64(je->t_rate[i]);
je->m_iops[i] = cpu_to_le32(je->m_iops[i]);
je->t_iops[i] = cpu_to_le32(je->t_iops[i]);
- je->rate[i] = cpu_to_le32(je->rate[i]);
+ je->rate[i] = cpu_to_le64(je->rate[i]);
je->iops[i] = cpu_to_le32(je->iops[i]);
}