[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170517120739.2529-3-jack@suse.cz>
Date: Wed, 17 May 2017 14:07:39 +0200
From: Jan Kara <jack@...e.cz>
To: Ted Tso <tytso@....edu>
Cc: <linux-ext4@...r.kernel.org>, Jan Kara <jack@...e.cz>
Subject: [PATCH 2/2] ext4: Fix off-by-in in loop termination in ext4_find_unwritten_pgoff()
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@...e.cz>
---
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
Powered by blists - more mailing lists