* + libfs-make-simple_read_from_buffer-conventional.patch added to -mm tree
@ 2009-03-04 21:48 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2009-03-04 21:48 UTC (permalink / raw)
To: mm-commits; +Cc: rostedt, hpa, mingo, srostedt, tytso, viro
The patch titled
libfs: make simple_read_from_buffer conventional
has been added to the -mm tree. Its filename is
libfs-make-simple_read_from_buffer-conventional.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find
out what to do about this
The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/
------------------------------------------------------
Subject: libfs: make simple_read_from_buffer conventional
From: Steven Rostedt <rostedt@goodmis.org>
Impact: have simple_read_from_buffer conform to standards
It was brought to my attention by Andrew Morton, Theodore Tso, and H.
Peter Anvin that a read from userspace should only return -EFAULT if
nothing was actually read.
Looking at the simple_read_from_buffer I noticed that this function does
not conform to that rule. This patch fixes that function.
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
fs/libfs.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff -puN fs/libfs.c~libfs-make-simple_read_from_buffer-conventional fs/libfs.c
--- a/fs/libfs.c~libfs-make-simple_read_from_buffer-conventional
+++ a/fs/libfs.c
@@ -526,14 +526,20 @@ ssize_t simple_read_from_buffer(void __u
const void *from, size_t available)
{
loff_t pos = *ppos;
+ size_t ret;
+
if (pos < 0)
return -EINVAL;
if (pos >= available)
return 0;
if (count > available - pos)
count = available - pos;
- if (copy_to_user(to, from + pos, count))
- return -EFAULT;
+ ret = copy_to_user(to, from + pos, count);
+ if (ret) {
+ if (ret == count)
+ return -EFAULT;
+ count -= ret;
+ }
*ppos = pos + count;
return count;
}
_
Patches currently in -mm which might be from rostedt@goodmis.org are
linux-next.patch
libfs-make-simple_read_from_buffer-conventional.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-03-04 21:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04 21:48 + libfs-make-simple_read_from_buffer-conventional.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.