]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Grow.c
Improve error message for adding bitmap to a level that cannot support it.
[thirdparty/mdadm.git] / Grow.c
diff --git a/Grow.c b/Grow.c
index c28c1ac59e9881671b5f07e5c30fc24089b906d9..52907fa0a83934cc352caab6ef26b899cf4e58bf 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -254,6 +254,11 @@ int Grow_addbitmap(char *devname, int fd, char *file, int chunk, int delay, int
                        devname);
                return 1;
        }
+       if (array.level <= 0) {
+               fprintf(stderr, Name ": Bitmaps not meaningful with level %s\n",
+                       map_num(pers, array.level)?:"of this array");
+               return 1;
+       }
        bitmapsize = array.size;
        bitmapsize <<= 1;
        if (get_dev_size(fd, NULL, &array_size) &&