]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix Atari prober logic
authorKarel Zak <kzak@redhat.com>
Fri, 9 Oct 2020 11:06:08 +0000 (13:06 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 9 Oct 2020 11:06:08 +0000 (13:06 +0200)
Addresses: https://github.com/karelzak/util-linux/issues/1159
Addresses: https://github.com/karelzak/util-linux/issues/1116
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/atari.c

index f8b6fb5b536c2f64cee3f14c7120757a47dbd7d8..f9404f9e1784ad73cac1e78e757623f48459276e 100644 (file)
@@ -199,11 +199,10 @@ static int probe_atari_pt(blkid_probe pr,
 
        hdsize = blkid_probe_get_size(pr) / 512;
 
-       /* Look for validly looking primary partition */
-       for (i = 0; ; i++) {
-               if (i >= ARRAY_SIZE(rs->part))
-                       goto nothing;
-
+       /*
+        * At least one valid partition required
+        */
+       for (i = 0; i < 4; i++) {
                if (IS_PARTDEF_VALID(rs->part[i], hdsize)) {
                        if (blkid_probe_set_magic(pr,
                                        offsetof(struct atari_rootsector, part[i]),
@@ -214,6 +213,9 @@ static int probe_atari_pt(blkid_probe pr,
                }
        }
 
+       if (i == 4)
+               goto nothing;
+
        if (blkid_partitions_need_typeonly(pr))
                /* caller does not ask for details about partitions */
                return BLKID_PROBE_OK;