[PATCH 2/2] ext4: Fix off-by-in in loop termination in ext4_find_unwritten_pgoff()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is an off-by-one error in loop termination conditions in
ext4_find_unwritten_pgoff(). It doesn't have any visible effects but
still it is good to fix it.

Signed-off-by: Jan Kara <jack@xxxxxxx>
---
 fs/ext4/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/file.c b/fs/ext4/file.c
index bbea2dccd584..a80f42d189e3 100644
--- a/fs/ext4/file.c
+++ b/fs/ext4/file.c
@@ -502,7 +502,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
 				goto out;
 			}
 
-			if (page->index > end)
+			if (page->index >= end)
 				goto out;
 
 			lock_page(page);
@@ -550,7 +550,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
 
 		index = pvec.pages[i - 1]->index + 1;
 		pagevec_release(&pvec);
-	} while (index <= end);
+	} while (index < end);
 
 	if (whence == SEEK_HOLE && lastoff < endoff) {
 		found = 1;
-- 
2.12.0




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux