public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org, pj@sgi.com
Subject: [PATCH] cpuset crapectomy
Date: Fri, 30 Sep 2005 03:26:43 +0100	[thread overview]
Message-ID: <20050930022643.GA7992@ftp.linux.org.uk> (raw)

	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>
----
diff -urN RC14-rc2-git6-base/kernel/cpuset.c current/kernel/cpuset.c
--- RC14-rc2-git6-base/kernel/cpuset.c	2005-09-28 21:33:37.000000000 -0400
+++ current/kernel/cpuset.c	2005-09-29 16:09:00.000000000 -0400
@@ -968,8 +968,6 @@
 	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 @@
 	*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;

             reply	other threads:[~2005-09-30  2:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-30  2:26 Al Viro [this message]
2005-09-30 14:30 ` [PATCH] cpuset crapectomy Paul Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050930022643.GA7992@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pj@sgi.com \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox