]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] cpuset crapectomy
authorAl Viro <viro@ftp.linux.org.uk>
Fri, 30 Sep 2005 02:26:43 +0000 (03:26 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 30 Sep 2005 15:42:24 +0000 (08:42 -0700)
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>
kernel/cpuset.c

index 6a6e87b2f2fd0d245aaf48a9a42a07e4bbe9dd83..45a5719a01047b2355a6eaffe4f1b75c3e22d915 100644 (file)
@@ -968,8 +968,6 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
        char *page;
        ssize_t retval = 0;
        char *s;
-       char *start;
-       ssize_t n;
 
        if (!(page = (char *)__get_free_page(GFP_KERNEL)))
                return -ENOMEM;
@@ -999,15 +997,7 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf,
        *s++ = '\n';
        *s = '\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;
+       retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page);
 out:
        free_page((unsigned long)page);
        return retval;