diff options
author | Alex Elder <aelder@sgi.com> | 2009-10-08 13:53:44 -0500 |
---|---|---|
committer | Alex Elder <aelder@sgi.com> | 2009-10-08 13:53:44 -0500 |
commit | e09d39968bd8befa087f10f970fa236e8694b643 (patch) | |
tree | 393f4cdd32504ed435b7a5f728cf74855378459d /fs/xfs/xfs_dir2_leaf.c | |
parent | fdec29c5fcd2705d61c1d14a1d4c74be03e9627c (diff) | |
parent | d0800703febc04827b8fa91921aa4e254d01e8d1 (diff) |
Merge branch 'master' into for-linus
Diffstat (limited to 'fs/xfs/xfs_dir2_leaf.c')
-rw-r--r-- | fs/xfs/xfs_dir2_leaf.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c index fa913e45944..41ad537c49e 100644 --- a/fs/xfs/xfs_dir2_leaf.c +++ b/fs/xfs/xfs_dir2_leaf.c @@ -854,6 +854,7 @@ xfs_dir2_leaf_getdents( */ ra_want = howmany(bufsize + mp->m_dirblksize, mp->m_sb.sb_blocksize) - 1; + ASSERT(ra_want >= 0); /* * If we don't have as many as we want, and we haven't @@ -1088,7 +1089,8 @@ xfs_dir2_leaf_getdents( */ ptr += length; curoff += length; - bufsize -= length; + /* bufsize may have just been a guess; don't go negative */ + bufsize = bufsize > length ? bufsize - length : 0; } /* |