From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: kernel-janitors@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 8/9] fs: nfs: misused copy_to_user() return value
Date: Fri, 30 Jul 2010 13:47:27 -0400 [thread overview]
Message-ID: <1280512047.12852.8.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1280488190-20979-1-git-send-email-segooon@gmail.com>
On Fri, 2010-07-30 at 15:09 +0400, Kulikov Vasiliy wrote:
> copy_to_user() returns nonzero value on error, this value may be any
> value between 0 and requested count, not only requested count.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
> fs/nfs/idmap.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
> index 21a84d4..a9f2cd5 100644
> --- a/fs/nfs/idmap.c
> +++ b/fs/nfs/idmap.c
> @@ -362,7 +362,7 @@ idmap_pipe_upcall(struct file *filp, struct rpc_pipe_msg *msg,
> unsigned long left;
>
> left = copy_to_user(dst, data, mlen);
> - if (left == mlen) {
> + if (left)
> msg->errno = -EFAULT;
> return -EFAULT;
> }
...and we do handle the case where copy_to_user returns less than the
requested number of bytes: it is called a 'short read' and is quite
allowed in POSIX. The userland application can just call sys_read()
again...
Trond
next prev parent reply other threads:[~2010-07-30 17:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 11:09 [PATCH 8/9] fs: nfs: misused copy_to_user() return value Kulikov Vasiliy
2010-07-30 17:47 ` Trond Myklebust [this message]
[not found] ` <1280512047.12852.8.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-07-30 18:03 ` Vasiliy Kulikov
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=1280512047.12852.8.camel@heimdal.trondhjem.org \
--to=trond.myklebust@netapp.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=segooon@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).