summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2013-07-25 19:37:49 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2013-07-25 19:37:49 +0000
commit9670f4810701c16d3168d742058e59a84c29130e (patch)
tree93f25af3aea855a5f7481b3d685862fab52155ca /sys
parent513bfc4fe2001b69d379390bf767081bd87b6617 (diff)
downloadsrc-test2-9670f4810701c16d3168d742058e59a84c29130e.tar.gz
src-test2-9670f4810701c16d3168d742058e59a84c29130e.zip
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/ext2fs/ext2_lookup.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/sys/fs/ext2fs/ext2_lookup.c b/sys/fs/ext2fs/ext2_lookup.c
index 71f1fbe24c9e..990ed330217f 100644
--- a/sys/fs/ext2fs/ext2_lookup.c
+++ b/sys/fs/ext2fs/ext2_lookup.c
@@ -146,6 +146,8 @@ ext2_readdir(struct vop_readdir_args *ap)
int DIRBLKSIZ = VTOI(ap->a_vp)->i_e2fs->e2fs_bsize;
int error;
+ if (uio->uio_offset < 0)
+ return (EINVAL);
ip = VTOI(vp);
if (ap->a_ncookies != NULL) {
ncookies = uio->uio_resid;
@@ -162,14 +164,6 @@ ext2_readdir(struct vop_readdir_args *ap)
ncookies = 0;
cookies = NULL;
}
- /*
- * Avoid complications for partial directory entries by adjusting
- * the i/o to end at a block boundary. Don't give up (like ufs
- * does) if the initial adjustment gives a negative count, since
- * many callers don't supply a large enough buffer. The correct
- * size is a little larger than DIRBLKSIZ to allow for expansion
- * of directory entries, but some callers just use 512.
- */
offset = startoffset = uio->uio_offset;
startresid = uio->uio_resid;
error = 0;