dcavalca / rpms / util-linux

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