From 194fffd042d374d5e13af61a14fe16734c396d8c Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Thu, 24 Sep 2015 20:35:44 -0600 Subject: [PATCH] Fix integer overflow in rate_iops For the following job file: [bla] rw=randread bs=1024m rate_iops=100 We end up overflowing in multiplication, making the bps field 0. Fio exits by reporting: rate lower than supported Fix this by casting to uint64_t, the type of the output. Signed-off-by: Jens Axboe --- init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.c b/init.c index cdb98c57..684cd600 100644 --- a/init.c +++ b/init.c @@ -465,7 +465,7 @@ static int __setup_rate(struct thread_data *td, enum fio_ddir ddir) if (td->o.rate[ddir]) td->rate_bps[ddir] = td->o.rate[ddir]; else - td->rate_bps[ddir] = td->o.rate_iops[ddir] * bs; + td->rate_bps[ddir] = (uint64_t) td->o.rate_iops[ddir] * bs; if (!td->rate_bps[ddir]) { log_err("rate lower than supported\n"); -- 2.25.1