svn commit: r258088 - head/sys/fs/pseudofs
Konstantin Belousov
kib at FreeBSD.org
Wed Nov 13 08:55:09 UTC 2013
Author: kib
Date: Wed Nov 13 08:55:09 2013
New Revision: 258088
URL: http://svnweb.freebsd.org/changeset/base/258088
Log:
Remove useless comparisions of assigned offset and resid with the
sources from uio. Both uio_offset and offset, and uio_resid and resid
have the same types for some time.
Add check for buflen overflow by comparing the buflen with both offset
and resid (vs. comparing with offset only, as it is currently done).
Reported and tested by: pho
Approved by: des (pseudofs maintainer)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/fs/pseudofs/pseudofs_vnops.c
Modified: head/sys/fs/pseudofs/pseudofs_vnops.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vnops.c Wed Nov 13 08:45:37 2013 (r258087)
+++ head/sys/fs/pseudofs/pseudofs_vnops.c Wed Nov 13 08:55:09 2013 (r258088)
@@ -654,11 +654,13 @@ pfs_read(struct vop_read_args *va)
goto ret;
}
+ resid = uio->uio_resid;
+ offset = uio->uio_offset;
+ buflen = offset + resid;
+
/* beaucoup sanity checks so we don't ask for bogus allocation */
- if (uio->uio_offset < 0 || uio->uio_resid < 0 ||
- (offset = uio->uio_offset) != uio->uio_offset ||
- (resid = uio->uio_resid) != uio->uio_resid ||
- (buflen = offset + resid) < offset || buflen >= INT_MAX) {
+ if (resid < 0 || buflen < offset || buflen < resid ||
+ buflen >= INT_MAX) {
error = EINVAL;
goto ret;
}
More information about the svn-src-all
mailing list