]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: fix SIGFPE stable/v2.23
authorKarel Zak <kzak@redhat.com>
Mon, 9 Sep 2013 08:57:50 +0000 (10:57 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 9 Sep 2013 08:57:50 +0000 (10:57 +0200)
 #0 recount_geometry at libfdisk/src/alignment.c:143
 #1 fdisk_discover_geometry at libfdisk/src/alignment.c:205
 #2 fdisk_context_assign_device at libfdisk/src/context.c:173
 #3 print_partition_table_from_option at fdisks/fdisk.c:924

References: https://bugzilla.redhat.com/show_bug.cgi?id=1005566
Signed-off-by: Karel Zak <kzak@redhat.com>
libfdisk/src/alignment.c

index ac44e73c11ddcaec399ff8e3fd31b3be26c89363..4d4ab4804bb963e3d5adf71f83c2fb637e2e0711 100644 (file)
@@ -193,11 +193,12 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
 
        /* what the kernel/bios thinks the geometry is */
        blkdev_get_geometry(cxt->dev_fd, &h, &s);
-       if (!h && !s) {
-               /* unable to discover geometry, use default values */
-               s = 63;
+
+       /* defaults */
+       if (!h)
                h = 255;
-       }
+       if (!s)
+               s = 63;
 
        /* obtained heads and sectors */
        cxt->geom.heads = h;