Date: Wed, 13 Nov 2013 08:55:09 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258088 - head/sys/fs/pseudofs Message-ID: <201311130855.rAD8t9nt047738@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311130855.rAD8t9nt047738>