3d071d
From 214eaa70d8431161de03ea7903f814c102e87919 Mon Sep 17 00:00:00 2001
3d071d
From: Karel Zak <kzak@redhat.com>
3d071d
Date: Fri, 9 Oct 2020 13:06:08 +0200
3d071d
Subject: libblkid: fix Atari prober logic
3d071d
3d071d
Addresses: https://github.com/karelzak/util-linux/issues/1159
3d071d
Addresses: https://github.com/karelzak/util-linux/issues/1116
3d071d
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2060030
3d071d
Upstream: http://github.com/util-linux/util-linux/commit/282ceadc3a72fc07dd0388b8880fd751490bb87f
3d071d
Signed-off-by: Karel Zak <kzak@redhat.com>
3d071d
---
3d071d
 libblkid/src/partitions/atari.c | 12 +++++++-----
3d071d
 1 file changed, 7 insertions(+), 5 deletions(-)
3d071d
3d071d
diff --git a/libblkid/src/partitions/atari.c b/libblkid/src/partitions/atari.c
3d071d
index 1224a577c..b469ef5a1 100644
3d071d
--- a/libblkid/src/partitions/atari.c
3d071d
+++ b/libblkid/src/partitions/atari.c
3d071d
@@ -199,11 +199,10 @@ static int probe_atari_pt(blkid_probe pr,
3d071d
 
3d071d
 	hdsize = blkid_probe_get_size(pr) / 512;
3d071d
 
3d071d
-	/* Look for validly looking primary partition */
3d071d
-	for (i = 0; ; i++) {
3d071d
-		if (i >= ARRAY_SIZE(rs->part))
3d071d
-			goto nothing;
3d071d
-
3d071d
+	/*
3d071d
+	 * At least one valid partition required
3d071d
+	 */
3d071d
+	for (i = 0; i < 4; i++) {
3d071d
 		if (IS_PARTDEF_VALID(rs->part[i], hdsize)) {
3d071d
 			blkid_probe_set_magic(pr,
3d071d
 				offsetof(struct atari_rootsector, part[i]),
3d071d
@@ -213,6 +212,9 @@ static int probe_atari_pt(blkid_probe pr,
3d071d
 		}
3d071d
 	}
3d071d
 
3d071d
+	if (i == 4)
3d071d
+		goto nothing;
3d071d
+
3d071d
 	if (blkid_partitions_need_typeonly(pr))
3d071d
 		/* caller does not ask for details about partitions */
3d071d
 		return BLKID_PROBE_OK;
3d071d
-- 
3d071d
2.36.1
3d071d