diff options
| author | Jeff Roberson <jeff@FreeBSD.org> | 2013-08-09 03:24:48 +0000 |
|---|---|---|
| committer | Jeff Roberson <jeff@FreeBSD.org> | 2013-08-09 03:24:48 +0000 |
| commit | 3d71c6cf45c84126af4ce50d0c4c4edc3407026b (patch) | |
| tree | 1abc8c388c86ef0859c1c5df828574363486d523 /sys | |
| parent | ba397d0f16f558022785ed069e0b0612ca67c8df (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/ofed/include/linux/sysfs.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/ofed/include/linux/sysfs.h b/sys/ofed/include/linux/sysfs.h index 4a763c8287d3..c60a2b904e62 100644 --- a/sys/ofed/include/linux/sysfs.h +++ b/sys/ofed/include/linux/sysfs.h @@ -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. */ |
