rbd: fix crash with zero sized image
[fio.git] / engines / rbd.c
index aa50c801c3c831eec13a5c212fdc836c7f85e675..ee2ce813b9ae2d6e3bb2ac3649a9e909573ea7f0 100644 (file)
@@ -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,