linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group
Date: Fri, 20 Jul 2007 16:50:26 -0500	[thread overview]
Message-ID: <46A12E22.3030102@redhat.com> (raw)

The test in ext2fs_check_desc() is off by one; if the inode table
goes all the way to the last block of the block group, it will 
falsely assert that it has extended past it.  The last block
of a range is start + len -1, not start + len.

Testcase to follow.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: e2fsprogs-1.40.2/lib/ext2fs/check_desc.c
===================================================================
--- e2fsprogs-1.40.2.orig/lib/ext2fs/check_desc.c
+++ e2fsprogs-1.40.2/lib/ext2fs/check_desc.c
@@ -61,7 +61,7 @@ errcode_t ext2fs_check_desc(ext2_filsys 
 		 */
 		if (fs->group_desc[i].bg_inode_table < first_block ||
 		    ((fs->group_desc[i].bg_inode_table +
-		      fs->inode_blocks_per_group) > last_block))
+		      fs->inode_blocks_per_group - 1) > last_block))
 			return EXT2_ET_GDESC_BAD_INODE_TABLE;
 	}
 	return 0;

             reply	other threads:[~2007-07-20 21:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-20 21:50 Eric Sandeen [this message]
2007-07-20 22:04 ` [PATCH e2fsprogs] fix test in ext2fs_check_desc() for inode table within block group Eric Sandeen
2007-07-22 20:01 ` Theodore Tso

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=46A12E22.3030102@redhat.com \
    --to=sandeen@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    /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).