diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-03 11:36:55 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-09-03 11:36:55 -0700 |
commit | 41488202f1afac2e7425cc4d4a3b4208c3e2cc8c (patch) | |
tree | a5ccee1c7c95ec760b8abe3c6230a8adfee03c7f /fs/sysfs | |
parent | 018c81b827563c4d64ad79f9b90ea985a65bff4d (diff) | |
parent | 17d0774f80681020eccc9638d925a23f1fc4f671 (diff) | |
download | lwn-41488202f1afac2e7425cc4d4a3b4208c3e2cc8c.tar.gz lwn-41488202f1afac2e7425cc4d4a3b4208c3e2cc8c.zip |
Merge tag 'driver-core-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fixes from Greg KH:
"Here are three small fixes for 4.8-rc5.
One for sysfs, one for kernfs, and one documentation fix, all for
reported issues. All of these have been in linux-next for a while"
* tag 'driver-core-4.8-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
sysfs: correctly handle read offset on PREALLOC attrs
documentation: drivers/core/of: fix name of of_node symlink
kernfs: don't depend on d_find_any_alias() when generating notifications
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/file.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index f35523d4fa3a..b803213d1307 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c @@ -114,9 +114,15 @@ static ssize_t sysfs_kf_read(struct kernfs_open_file *of, char *buf, * If buf != of->prealloc_buf, we don't know how * large it is, so cannot safely pass it to ->show */ - if (pos || WARN_ON_ONCE(buf != of->prealloc_buf)) + if (WARN_ON_ONCE(buf != of->prealloc_buf)) return 0; len = ops->show(kobj, of->kn->priv, buf); + if (pos) { + if (len <= pos) + return 0; + len -= pos; + memmove(buf, buf + pos, len); + } return min(count, len); } |