From 7c306bb1d27de928cba1b58d7888981d44416fd1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 24 Apr 2015 10:41:58 -0600 Subject: [PATCH 1/1] io_u: fix bug in rounding of generated buffer length If the maximum blocksize isn't a multiple of the minimum blocksize, then fio has a bug where it will round up the block size and align it to a size larger than the IO buffer we have. This causes random memory corruption and crashes. Signed-off-by: Jens Axboe --- io_u.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index ba3f7ca0..50644850 100644 --- a/io_u.c +++ b/io_u.c @@ -485,7 +485,7 @@ static unsigned int __get_next_buflen(struct thread_data *td, struct io_u *io_u, ~(td->o.verify_interval - 1); if (!td->o.bs_unaligned && is_power_of_2(minbs)) - buflen = (buflen + minbs - 1) & ~(minbs - 1); + buflen &= ~(minbs - 1); } while (!io_u_fits(td, io_u, buflen)); -- 2.25.1