While running fstests generic/095 against ext4 on a zram device I started seeing fio crashing. Fix it by making sure io_u->file isn't NULL before accessing it. Signed-off-by: Luís Henriques <lhenriques@xxxxxxx> --- io_u.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/io_u.c b/io_u.c index 5289b5d1d9c6..b8e715d4118c 100644 --- a/io_u.c +++ b/io_u.c @@ -2009,7 +2009,8 @@ static void io_completed(struct thread_data *td, struct io_u **io_u_ptr, io_u->xfer_buf += bytes; io_u->offset += bytes; td->ts.short_io_u[io_u->ddir]++; - if (io_u->offset < io_u->file->real_file_size) { + if (io_u->file && + (io_u->offset < io_u->file->real_file_size)) { requeue_io_u(td, io_u_ptr); return; }