dcavalca / rpms / util-linux

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