diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 1f06e7690106..712d02029971 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));