summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cpuset.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 1f06e769010..712d0202997 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -972,6 +972,10 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
*s++ = '\n';
*s = '\0';
+ /* Do nothing if *ppos is at the eof or beyond the eof. */
+ if (s - page <= *ppos)
+ return 0;
+
start = page + *ppos;
n = s - start;
retval = n - copy_to_user(buf, start, min(n, nbytes));