linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] off-by-one in "Add checks to validate extent entries."
@ 2009-04-02 17:12 Thiemo Nagel
  2009-04-05  3:24 ` Theodore Tso
  0 siblings, 1 reply; 3+ messages in thread
From: Thiemo Nagel @ 2009-04-02 17:12 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Theodore Tso; +Cc: linux-ext4

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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] off-by-one in "Add checks to validate extent entries."
  2009-04-02 17:12 [PATCH] off-by-one in "Add checks to validate extent entries." Thiemo Nagel
@ 2009-04-05  3:24 ` Theodore Tso
  2009-04-05 10:21   ` Thiemo Nagel
  0 siblings, 1 reply; 3+ messages in thread
From: Theodore Tso @ 2009-04-05  3:24 UTC (permalink / raw)
  To: Thiemo Nagel; +Cc: Aneesh Kumar K.V, linux-ext4

On Thu, Apr 02, 2009 at 07:12:55PM +0200, Thiemo Nagel wrote:
> 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

In the future, could you please remember to include a Signed-off-by:
for your patches?

Thanks!!

This one is simple enough that I'll just include it, but I'd really
prefer to get explicit signed-off patches.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] off-by-one in "Add checks to validate extent entries."
  2009-04-05  3:24 ` Theodore Tso
@ 2009-04-05 10:21   ` Thiemo Nagel
  0 siblings, 0 replies; 3+ messages in thread
From: Thiemo Nagel @ 2009-04-05 10:21 UTC (permalink / raw)
  To: Theodore Tso; +Cc: linux-ext4

Theodore Tso wrote:
> On Thu, Apr 02, 2009 at 07:12:55PM +0200, Thiemo Nagel wrote:
>> 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
> 
> In the future, could you please remember to include a Signed-off-by:
> for your patches?
> 
> Thanks!!
> 
> This one is simple enough that I'll just include it, but I'd really
> prefer to get explicit signed-off patches.

Ok.  So just for the record:

Signed-off-by: Thiemo Nagel <thiemo.nagel@ph.tum.de>

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


-- 
+-----------------------------------+--------------------------+
| Dipl.-Phys. Thiemo Nagel          |                          |
| Technische Universitaet Muenchen  | Room    PH1 3276         |
| Physik-Department E18             |                          |
| James-Franck-Strasse              | Phone  +49 89 289-12379  |
| D-85747 Garching                  | Fax    +49 89 289-12570  |
+-----------------------------------+--------------------------+

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-05 10:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 17:12 [PATCH] off-by-one in "Add checks to validate extent entries." Thiemo Nagel
2009-04-05  3:24 ` Theodore Tso
2009-04-05 10:21   ` Thiemo Nagel

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