aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2011-05-11 15:04:07 +0000
committerAlex Elder <aelder@sgi.com>2011-05-25 10:48:37 -0500
commit5690f92199956c0f2a2d9f718b5031e1300a1de1 (patch)
tree66ae28ac9f0fe4deae3452f81f244ae162a25fcb /fs/xfs/xfs_bmap.c
parent2f2b3220b0566692da14e06ea5fc0d697a78dc7c (diff)
downloadkernel_goldelico_gta04-5690f92199956c0f2a2d9f718b5031e1300a1de1.zip
kernel_goldelico_gta04-5690f92199956c0f2a2d9f718b5031e1300a1de1.tar.gz
kernel_goldelico_gta04-5690f92199956c0f2a2d9f718b5031e1300a1de1.tar.bz2
xfs: do not use unchecked extent indices in xfs_bmapi
Make sure to only call xfs_iext_get_ext after we've validate the extent index when moving on to the next index in xfs_bmapi. Based on an earlier patch from Lachlan McIlroy. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Lachlan McIlroy <lmcilroy@redhat.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/xfs_bmap.c')
-rw-r--r--fs/xfs/xfs_bmap.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 130ec4f..af655c1 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -4825,12 +4825,13 @@ xfs_bmapi(
/*
* Else go on to the next record.
*/
- ep = xfs_iext_get_ext(ifp, ++lastx);
prev = got;
- if (lastx >= nextents)
- eof = 1;
- else
+ if (++lastx < nextents) {
+ ep = xfs_iext_get_ext(ifp, lastx);
xfs_bmbt_get_all(ep, &got);
+ } else {
+ eof = 1;
+ }
}
*nmap = n;
/*