From 5cc91287634881eb199b38c778c62f50b285e696 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Fri, 25 Sep 2009 19:42:26 +0000 Subject: [PATCH] --- yaml --- r: 167175 b: refs/heads/master c: 8e69ce147127a0235e8d1f2b75ea214be78c61b3 h: refs/heads/master i: 167173: 67aabb2df5ed3d1129686f833400d090286a61e2 167171: 5b47f5e495acbe9f61f7725a5365d8f93a2e5408 167167: f56ef75aea235340a1004f5f02d78a38a365e7f0 v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_dir2_leaf.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index ab89cc75f367..5f906234406f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: dce5065a57c158e0ca5db8e63c50118b2ecf4ac5 +refs/heads/master: 8e69ce147127a0235e8d1f2b75ea214be78c61b3 diff --git a/trunk/fs/xfs/xfs_dir2_leaf.c b/trunk/fs/xfs/xfs_dir2_leaf.c index fa913e459442..41ad537c49e9 100644 --- a/trunk/fs/xfs/xfs_dir2_leaf.c +++ b/trunk/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; } /*