From owner-svn-src-head@FreeBSD.ORG Wed Nov 13 08:55:09 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8F82C2D4; Wed, 13 Nov 2013 08:55:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F90A2F2D; Wed, 13 Nov 2013 08:55:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rAD8t9Fx047739; Wed, 13 Nov 2013 08:55:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rAD8t9nt047738; Wed, 13 Nov 2013 08:55:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201311130855.rAD8t9nt047738@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 13 Nov 2013 08:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r258088 - head/sys/fs/pseudofs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Nov 2013 08:55:09 -0000 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; }