From owner-svn-src-head@FreeBSD.ORG Fri Aug 9 03:24:49 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 667FC2F9; Fri, 9 Aug 2013 03:24:49 +0000 (UTC) (envelope-from jeff@FreeBSD.org) 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 5547528C2; Fri, 9 Aug 2013 03:24:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r793Onai005866; Fri, 9 Aug 2013 03:24:49 GMT (envelope-from jeff@svn.freebsd.org) Received: (from jeff@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r793OnXc005865; Fri, 9 Aug 2013 03:24:49 GMT (envelope-from jeff@svn.freebsd.org) Message-Id: <201308090324.r793OnXc005865@svn.freebsd.org> From: Jeff Roberson Date: Fri, 9 Aug 2013 03:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254121 - head/sys/ofed/include/linux 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.14 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: Fri, 09 Aug 2013 03:24:49 -0000 Author: jeff Date: Fri Aug 9 03:24:48 2013 New Revision: 254121 URL: http://svnweb.freebsd.org/changeset/base/254121 Log: - Correctly handle various edge cases in sysfs emulation. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/ofed/include/linux/sysfs.h Modified: head/sys/ofed/include/linux/sysfs.h ============================================================================== --- head/sys/ofed/include/linux/sysfs.h Fri Aug 9 03:24:12 2013 (r254120) +++ head/sys/ofed/include/linux/sysfs.h Fri Aug 9 03:24:48 2013 (r254121) @@ -97,11 +97,14 @@ sysctl_handle_attr(SYSCTL_HANDLER_ARGS) error = -len; if (error != EIO) goto out; + buf[0] = '\0'; + } else if (len) { + len--; + if (len >= PAGE_SIZE) + len = PAGE_SIZE - 1; + /* Trim trailing newline. */ + buf[len] = '\0'; } - - /* Trim trailing newline. */ - len--; - buf[len] = '\0'; } /* Leave one trailing byte to append a newline. */