diff options
author | Paul Mackerras <paulus@samba.org> | 2005-09-29 13:13:36 +1000 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-09-29 13:13:36 +1000 |
commit | ab11d1ea281e85895369ef57c5259ad8a432fabb (patch) | |
tree | 684147479c6a8bb2fbed21bdcf12de1dd519c730 /kernel/cpuset.c | |
parent | 952ecef7a0479049c8abb7c34a688ec2981ceadd (diff) | |
parent | 664cceb0093b755739e56572b836a99104ee8a75 (diff) | |
download | kernel-crypto-ab11d1ea281e85895369ef57c5259ad8a432fabb.tar.gz kernel-crypto-ab11d1ea281e85895369ef57c5259ad8a432fabb.tar.xz kernel-crypto-ab11d1ea281e85895369ef57c5259ad8a432fabb.zip |
Merge by hand from Linus' tree.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r-- | kernel/cpuset.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 79866bc6b3a..6a6e87b2f2f 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, ssize_t retval = 0; char *s; char *start; - size_t n; + ssize_t n; if (!(page = (char *)__get_free_page(GFP_KERNEL))) return -ENOMEM; @@ -999,12 +999,13 @@ 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; + + /* Do nothing if *ppos is at the eof or beyond the eof. */ + if (n <= 0) + goto out; + retval = n - copy_to_user(buf, start, min(n, nbytes)); *ppos += retval; out: |