From owner-svn-src-all@FreeBSD.ORG Tue Mar 10 21:27:15 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7ABE106564A; Tue, 10 Mar 2009 21:27:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D62F28FC18; Tue, 10 Mar 2009 21:27:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2ALRFfA074057; Tue, 10 Mar 2009 21:27:15 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2ALRFK2074056; Tue, 10 Mar 2009 21:27:15 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200903102127.n2ALRFK2074056@svn.freebsd.org> From: John Baldwin Date: Tue, 10 Mar 2009 21:27:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r189648 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Mar 2009 21:27:16 -0000 Author: jhb Date: Tue Mar 10 21:27:15 2009 New Revision: 189648 URL: http://svn.freebsd.org/changeset/base/189648 Log: In the ABI shim for vfs.bufspace, rather than truncating values larger than INT_MAX to INT_MAX, just go ahead and write out the full long to give an error of ENOMEM to the user process. Requested by: bde Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Mar 10 21:13:26 2009 (r189647) +++ head/sys/kern/vfs_bio.c Tue Mar 10 21:27:15 2009 (r189648) @@ -287,7 +287,10 @@ sysctl_bufspace(SYSCTL_HANDLER_ARGS) if (sizeof(int) == sizeof(long) || req->oldlen == sizeof(long)) return (sysctl_handle_long(oidp, arg1, arg2, req)); lvalue = *(long *)arg1; - ivalue = lvalue > INT_MAX ? INT_MAX : lvalue; + if (lvalue > INT_MAX) + /* On overflow, still write out a long to trigger ENOMEM. */ + return (sysctl_handle_long(oidp, &lvalue, 0, req)); + ivalue = lvalue; return (sysctl_handle_int(oidp, &ivalue, 0, req)); } #endif