From: Jens Axboe Date: Tue, 14 Mar 2023 19:58:13 +0000 (-0600) Subject: t/io_uring: avoid truncation of offset on 32-bit builds X-Git-Tag: fio-3.35~56 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=4d9521fd4d679f914ccf425f6c06864484352fea;p=fio.git t/io_uring: avoid truncation of offset on 32-bit builds Signed-off-by: Jens Axboe --- diff --git a/t/io_uring.c b/t/io_uring.c index 1ea0a9da..d39d7924 100644 --- a/t/io_uring.c +++ b/t/io_uring.c @@ -530,8 +530,11 @@ static unsigned long long get_offset(struct submitter *s, struct file *f) long r; if (random_io) { + unsigned long long block; + r = __rand64(&s->rand_state); - offset = (r % (f->max_blocks - 1)) * bs; + block = r % f->max_blocks; + offset = block * (unsigned long long) bs; } else { offset = f->cur_off; f->cur_off += bs;