linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thiemo Nagel <thiemo.nagel@ph.tum.de>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	Theodore Tso <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org
Subject: [PATCH] off-by-one in "Add checks to validate extent entries."
Date: Thu, 02 Apr 2009 19:12:55 +0200	[thread overview]
Message-ID: <49D4F217.7050105@ph.tum.de> (raw)

Theodore Tso wrote:
 > I haven't had time yet to check your other patches; could you also
 > take a quick scan to make sure we have all of the byte-swapping calls
 > needed for proper big-endian checking, that we're using the correct
 > __le32 types and not doing any casts?

I had a look at all patches I have sent, but I didn't notice anything 
suspicious.  While doing that, however I think I found an off-by-one in
56b19868aca856a7d7bf20c3a7a1030e4fd75b2b

Kind regards,

Thiemo

---
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index ac77d8b..6132353 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -342,7 +342,7 @@ static int ext4_valid_extent_idx(struct inode *inode,
         ext4_fsblk_t block = idx_pblock(ext_idx);
         struct ext4_super_block *es = EXT4_SB(inode->i_sb)->s_es;
         if (unlikely(block < le32_to_cpu(es->s_first_data_block) ||
-                       (block > ext4_blocks_count(es))))
+                       (block >= ext4_blocks_count(es))))
                 return 0;
         else
                 return 1;

             reply	other threads:[~2009-04-02 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-02 17:12 Thiemo Nagel [this message]
2009-04-05  3:24 ` [PATCH] off-by-one in "Add checks to validate extent entries." Theodore Tso
2009-04-05 10:21   ` Thiemo Nagel

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=49D4F217.7050105@ph.tum.de \
    --to=thiemo.nagel@ph.tum.de \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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).