From: Jens Axboe Date: Fri, 25 Sep 2015 02:35:44 +0000 (-0600) Subject: Fix integer overflow in rate_iops X-Git-Tag: fio-2.2.11~30 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=194fffd042d374d5e13af61a14fe16734c396d8c 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 --- 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");