From: Pan Liu Date: Sat, 12 Nov 2016 15:26:57 +0000 (+0800) Subject: rbd: fix crash with zero sized image X-Git-Tag: fio-2.16~24 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=206c546d6015fe3809b8e52ea95f56114b8e9f25 rbd: fix crash with zero sized image When the user create a rbd image with size zero, and specify the "size" larger than zero in fio option, rbd will crash. Signed-off-by: Pan Liu Signed-off-by: Jens Axboe --- diff --git a/engines/rbd.c b/engines/rbd.c index aa50c801..ee2ce813 100644 --- a/engines/rbd.c +++ b/engines/rbd.c @@ -595,7 +595,12 @@ static int fio_rbd_setup(struct thread_data *td) if (r < 0) { log_err("rbd_status failed.\n"); goto disconnect; + } else if (info.size == 0) { + log_err("image size should be larger than zero.\n"); + r = -EINVAL; + goto disconnect; } + dprint(FD_IO, "rbd-engine: image size: %lu\n", info.size); /* taken from "net" engine. Pretend we deal with files,