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