aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/cpuset.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 79866bc6b3a1..6a6e87b2f2fd 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -969,7 +969,7 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
969 ssize_t retval = 0; 969 ssize_t retval = 0;
970 char *s; 970 char *s;
971 char *start; 971 char *start;
972 size_t n; 972 ssize_t n;
973 973
974 if (!(page = (char *)__get_free_page(GFP_KERNEL))) 974 if (!(page = (char *)__get_free_page(GFP_KERNEL)))
975 return -ENOMEM; 975 return -ENOMEM;
@@ -999,12 +999,13 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
999 *s++ = '\n'; 999 *s++ = '\n';
1000 *s = '\0'; 1000 *s = '\0';
1001 1001
1002 /* Do nothing if *ppos is at the eof or beyond the eof. */
1003 if (s - page <= *ppos)
1004 return 0;
1005
1006 start = page + *ppos; 1002 start = page + *ppos;
1007 n = s - start; 1003 n = s - start;
1004
1005 /* Do nothing if *ppos is at the eof or beyond the eof. */
1006 if (n <= 0)
1007 goto out;
1008
1008 retval = n - copy_to_user(buf, start, min(n, nbytes)); 1009 retval = n - copy_to_user(buf, start, min(n, nbytes));
1009 *ppos += retval; 1010 *ppos += retval;
1010out: 1011out: