]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super1.c
super1: don't allow adding a bitmap if there is no space.
[thirdparty/mdadm.git] / super1.c
index 9834594c3e44d1553d564659bc81c5209cb807a6..02d6c7a155d16999909ffb7e0140f919ab65ee8d 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -2105,6 +2105,10 @@ add_internal_bitmap1(struct supertype *st,
                /* Limit to 128K of bitmap when chunk size not requested */
                room = 128*2;
 
+       if (room <= 1)
+               /* No room for a bitmap */
+               return 0;
+
        max_bits = (room * 512 - sizeof(bitmap_super_t)) * 8;
 
        min_chunk = 4096; /* sub-page chunks don't work yet.. */