cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
6717ab
From 44baaedaffee029dca76796b933412d97a19dff6 Mon Sep 17 00:00:00 2001
6717ab
From: Karel Zak <kzak@redhat.com>
6717ab
Date: Mon, 9 Sep 2013 10:57:50 +0200
6717ab
Subject: [PATCH] libfdisk: fix SIGFPE
6717ab
6717ab
 #0 recount_geometry at libfdisk/src/alignment.c:143
6717ab
 #1 fdisk_discover_geometry at libfdisk/src/alignment.c:205
6717ab
 #2 fdisk_context_assign_device at libfdisk/src/context.c:173
6717ab
 #3 print_partition_table_from_option at fdisks/fdisk.c:924
6717ab
6717ab
References: https://bugzilla.redhat.com/show_bug.cgi?id=1005566
6717ab
Signed-off-by: Karel Zak <kzak@redhat.com>
6717ab
---
6717ab
 libfdisk/src/alignment.c | 9 +++++----
6717ab
 1 file changed, 5 insertions(+), 4 deletions(-)
6717ab
6717ab
diff --git a/libfdisk/src/alignment.c b/libfdisk/src/alignment.c
6717ab
index ac44e73..4d4ab48 100644
6717ab
--- a/libfdisk/src/alignment.c
6717ab
+++ b/libfdisk/src/alignment.c
6717ab
@@ -193,11 +193,12 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
6717ab
 
6717ab
 	/* what the kernel/bios thinks the geometry is */
6717ab
 	blkdev_get_geometry(cxt->dev_fd, &h, &s);
6717ab
-	if (!h && !s) {
6717ab
-		/* unable to discover geometry, use default values */
6717ab
-		s = 63;
6717ab
+
6717ab
+	/* defaults */
6717ab
+	if (!h)
6717ab
 		h = 255;
6717ab
-	}
6717ab
+	if (!s)
6717ab
+		s = 63;
6717ab
 
6717ab
 	/* obtained heads and sectors */
6717ab
 	cxt->geom.heads = h;
6717ab
-- 
6717ab
1.8.1.4
6717ab