Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Aug 2013 03:24:49 +0000 (UTC)
From:      Jeff Roberson <jeff@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r254121 - head/sys/ofed/include/linux
Message-ID:  <201308090324.r793OnXc005865@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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. */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201308090324.r793OnXc005865>