diff options
| author | Alex Shi <alex.shi@linaro.org> | 2016-09-20 10:17:00 +0800 |
|---|---|---|
| committer | Alex Shi <alex.shi@linaro.org> | 2016-09-20 10:17:00 +0800 |
| commit | d2d693d1ba7d93ec7c5db8aca2da29a4c91f6782 (patch) | |
| tree | 41920dcc166c491e7192eb1e3ba3861dff479abf /fs/sysfs/file.c | |
| parent | 573787341e57a73bf027c2ea3bdf18dc298ae0a0 (diff) | |
| parent | 1d074db69c46d62ce82b331c2080e2fcb710bf4a (diff) | |
Merge remote-tracking branch 'lts/linux-4.4.y' into linux-linaro-lsk-v4.4
Conflicts:
set ARM64_WORKAROUND_CAVIUM_27456 to 12 in
arch/arm64/include/asm/cpufeature.h
and add asm/memory.h in arch/arm64/kernel/entry.S
Diffstat (limited to 'fs/sysfs/file.c')
| -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); } |
