linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@sandeen.net>
To: Eric Sandeen <sandeen@redhat.com>, xfs@oss.sgi.com
Subject: [PATCH 12/14 V2] xfs_repair: address never-true tests in repair/bmap.c on 64 bit
Date: Wed, 09 Apr 2014 09:36:54 -0500	[thread overview]
Message-ID: <53455B06.7000600@sandeen.net> (raw)
In-Reply-To: <1396999504-13769-13-git-send-email-sandeen@redhat.com>

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>
---

V2: Fix typo in comment in first hunk

 repair/bmap.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/repair/bmap.c b/repair/bmap.c
index 85d66dc..b81efb9 100644
--- a/repair/bmap.c
+++ b/repair/bmap.c
@@ -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"


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  parent reply	other threads:[~2014-04-09 14:37 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 23:24 [PATCH 00/14] xfsprogs: varius & sundry fixes for coverity defects Eric Sandeen
2014-04-08 23:24 ` [PATCH 01/14] xfsprogs: fix various fd leaks Eric Sandeen
2014-04-08 23:24 ` [PATCH 02/14] xfsprogs: refactor fsrall_cleanup in xfs_fsr Eric Sandeen
2014-04-08 23:24 ` [PATCH 03/14] xfsprogs: trivial buffer frees on error paths Eric Sandeen
2014-04-11 19:03   ` Brian Foster
2014-04-11 22:25   ` [PATCH 03/14 V2] " Eric Sandeen
2014-04-08 23:24 ` [PATCH 04/14] xfsprogs: fix memory leak in xlog_recover_add_to_trans Eric Sandeen
2014-04-08 23:24 ` [PATCH 05/14] libxfs: fix memory leak in xfs_dir2_node_removename Eric Sandeen
2014-04-08 23:24 ` [PATCH 06/14] xfs_quota: fix memory leak in quota_group_type() error path Eric Sandeen
2014-04-08 23:24 ` [PATCH 07/14] xfs_logprint: fix leak in error path of xlog_print_record() Eric Sandeen
2014-04-08 23:24 ` [PATCH 08/14] xfsprogs: free resources in libxfs_alloc_file_space error paths Eric Sandeen
2014-04-11 19:03   ` Brian Foster
2014-04-11 22:49   ` [PATCH 08/14 V2] " Eric Sandeen
2014-04-08 23:24 ` [PATCH 09/14] xfsprogs: annotate a case fallthrough in libxfs_ialloc Eric Sandeen
2014-04-08 23:25 ` [PATCH 10/14] xfsprogs: fix too-large memset value in xfs_db's attr code Eric Sandeen
2014-04-08 23:25 ` [PATCH 11/14] xfs_quota: remove impossible tests in printpath Eric Sandeen
2014-04-08 23:25 ` [PATCH 12/14] xfs_repair: address never-true tests in repair/bmap.c on 64 bit Eric Sandeen
2014-04-09 13:55   ` Mark Tinguely
2014-04-09 14:36   ` Eric Sandeen [this message]
2014-04-08 23:25 ` [PATCH 13/14] mkfs: catch unknown format in protofile parsing Eric Sandeen
2014-04-08 23:25 ` [PATCH 14/14] xfs_db: don't use invalid index in ring_f Eric Sandeen
2014-04-09 22:18 ` [PATCH 15/14] xfs_io: free memory on error path exit from bmap_f() Eric Sandeen
2014-04-10 13:38   ` Mark Tinguely
2014-04-10 14:15     ` Eric Sandeen
2014-04-11 19:02 ` [PATCH 00/14] xfsprogs: varius & sundry fixes for coverity defects Brian Foster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53455B06.7000600@sandeen.net \
    --to=sandeen@sandeen.net \
    --cc=sandeen@redhat.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).