ext4: fix off-by-in in loop termination in ext4_find_unwritten_pgoff()
[sfrench/cifs-2.6.git] / fs / ext4 / file.c
index bbea2dccd584384cafb7b2f1730baab05cd2d46f..2b00bf84c05bca35f13eb671b56ac2cdb17048f4 100644 (file)
@@ -474,7 +474,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode,
        endoff = (loff_t)end_blk << blkbits;
 
        index = startoff >> PAGE_SHIFT;
-       end = endoff >> PAGE_SHIFT;
+       end = (endoff - 1) >> PAGE_SHIFT;
 
        pagevec_init(&pvec, 0);
        do {