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@xxxxxxxxxxx> 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@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Theodore Ts'o <tytso@xxxxxxx> Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> Cc: Ingo Molnar <mingo@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- 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@xxxxxxxxxxx are linux-next.patch libfs-make-simple_read_from_buffer-conventional.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html