]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: address never-true tests in repair/bmap.c on 64 bit
authorEric Sandeen <sandeen@sandeen.net>
Mon, 14 Apr 2014 06:13:42 +0000 (16:13 +1000)
committerDave Chinner <david@fromorbit.com>
Mon, 14 Apr 2014 06:13:42 +0000 (16:13 +1000)
The test "if (new_naexts > BLKMAP_NEXTS_MAX)" is never true
on a 64-bit platform; new_naexts is an int, and BLKMAP_NEXTS_MAX
is INT_MAX.  So just wrap the whole thing in the #ifdef.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/bmap.c

index 85d66dc8ef7f4100b98389139b9b9822b1538b84..14161cb93999d21244580ac3d4bc6c718e8440e9 100644 (file)
@@ -47,16 +47,16 @@ blkmap_alloc(
        if (nex < 1)
                nex = 1;
 
+#if (BITS_PER_LONG == 32)      /* on 64-bit platforms this is never true */
        if (nex > BLKMAP_NEXTS_MAX) {
-#if (BITS_PER_LONG == 32)
                do_warn(
        _("Number of extents requested in blkmap_alloc (%d) overflows 32 bits.\n"
          "If this is not a corruption, then you will need a 64 bit system\n"
          "to repair this filesystem.\n"),
                        nex);
-#endif
                return NULL;
        }
+#endif
 
        key = whichfork ? ablkmap_key : dblkmap_key;
        blkmap = pthread_getspecific(key);
@@ -267,15 +267,15 @@ blkmap_grow(
                ASSERT(pthread_getspecific(key) == blkmap);
        }
 
+#if (BITS_PER_LONG == 32)      /* on 64-bit platforms this is never true */
        if (new_naexts > BLKMAP_NEXTS_MAX) {
-#if (BITS_PER_LONG == 32)
                do_error(
        _("Number of extents requested in blkmap_grow (%d) overflows 32 bits.\n"
          "You need a 64 bit system to repair this filesystem.\n"),
                        new_naexts);
-#endif
                return NULL;
        }
+#endif
        if (new_naexts <= 0) {
                do_error(
        _("Number of extents requested in blkmap_grow (%d) overflowed the\n"