]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (drbd) validate size in standard minsz predicate
authorThomas Weißschuh <thomas@t-8ch.de>
Sat, 30 Sep 2023 21:21:33 +0000 (23:21 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Sat, 30 Sep 2023 22:18:24 +0000 (00:18 +0200)
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/superblocks/drbd.c

index f3601864e3334176c95143ff72161e099f5f0872..bf9b82b6dba4057c0de8990fbe07cf140203a413 100644 (file)
@@ -131,10 +131,6 @@ static int probe_drbd_84(blkid_probe pr)
 
        off = pr->size - DRBD_MD_OFFSET;
 
-       /* Small devices cannot be drbd (?) */
-       if (pr->size < 0x10000)
-               return 1;
-
        md = (struct md_on_disk_08 *)
                        blkid_probe_get_buffer(pr,
                                        off,
@@ -172,14 +168,6 @@ static int probe_drbd_90(blkid_probe pr)
 
        off = pr->size - DRBD_MD_OFFSET;
 
-       /*
-        * Smaller ones are certainly not DRBD9 devices.
-        * Recent utils even refuse to generate larger ones,
-        * keep this as a sufficient lower bound.
-        */
-       if (pr->size < 0x10000)
-               return 1;
-
        md = (struct meta_data_on_disk_9 *)
                        blkid_probe_get_buffer(pr,
                                        off,
@@ -226,6 +214,12 @@ const struct blkid_idinfo drbd_idinfo =
        .name           = "drbd",
        .usage          = BLKID_USAGE_RAID,
        .probefunc      = probe_drbd,
+       /*
+        * Smaller ones are certainly not DRBD9 devices.
+        * Recent utils even refuse to generate larger ones,
+        * keep this as a sufficient lower bound.
+        */
+       .minsz          = 0x10000,
        .magics         = BLKID_NONE_MAGIC
 };