[PATCH] cpuset crapectomy
Switched cpuset_common_file_read() to simple_read_from_buffer(), killed a bunch of useless (and not quite correct - e.g. min(size_t,ssize_t)) code. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
46d7031ecb
commit
eacaa1f5aa
@ -968,8 +968,6 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
|
|||||||
char *page;
|
char *page;
|
||||||
ssize_t retval = 0;
|
ssize_t retval = 0;
|
||||||
char *s;
|
char *s;
|
||||||
char *start;
|
|
||||||
ssize_t n;
|
|
||||||
|
|
||||||
if (!(page = (char *)__get_free_page(GFP_KERNEL)))
|
if (!(page = (char *)__get_free_page(GFP_KERNEL)))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -999,15 +997,7 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
|
|||||||
*s++ = '\n';
|
*s++ = '\n';
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
start = page + *ppos;
|
retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);
|
||||||
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:
|
out:
|
||||||
free_page((unsigned long)page);
|
free_page((unsigned long)page);
|
||||||
return retval;
|
return retval;
|
||||||
|
Loading…
Reference in New Issue
Block a user