From: Jeff Dike <jdike@addtoit.com>
To: WANG Cong <xiyou.wangcong@gmail.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [uml-devel] [PATCH 6/19] UML - hppfs fixes
Date: Mon, 28 Apr 2008 11:29:40 -0400 [thread overview]
Message-ID: <20080428152940.GA7465@c2.user-mode-linux.org> (raw)
In-Reply-To: <20080426.163132.194697674.xiyou.wangcong@gmail.com>
On Sat, Apr 26, 2008 at 04:31:32PM +0800, WANG Cong wrote:
> > + rem = copy_to_user(buf, &data->contents[off], count);
> > + *ppos += count - rem;
> > + if (rem > 0)
> > + return -EFAULT;
>
> Could you please explain why check 'rem' after using it here?
Actually, this isn't as wrong as it looks. copy_to_user returns what
hasn't been copied (rem == remaining). So, I think the mistake is to
return -EFAULT here. Returning the short count would be right, unless
rem == count, in which case we return -EFAULT.
Jeff
--
Work email - jdike at linux dot intel dot com
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jeff Dike <jdike@addtoit.com>
To: WANG Cong <xiyou.wangcong@gmail.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
user-mode-linux-devel@lists.sourceforge.net
Subject: Re: [PATCH 6/19] UML - hppfs fixes
Date: Mon, 28 Apr 2008 11:29:40 -0400 [thread overview]
Message-ID: <20080428152940.GA7465@c2.user-mode-linux.org> (raw)
In-Reply-To: <20080426.163132.194697674.xiyou.wangcong@gmail.com>
On Sat, Apr 26, 2008 at 04:31:32PM +0800, WANG Cong wrote:
> > + rem = copy_to_user(buf, &data->contents[off], count);
> > + *ppos += count - rem;
> > + if (rem > 0)
> > + return -EFAULT;
>
> Could you please explain why check 'rem' after using it here?
Actually, this isn't as wrong as it looks. copy_to_user returns what
hasn't been copied (rem == remaining). So, I think the mistake is to
return -EFAULT here. Returning the short count would be right, unless
rem == count, in which case we return -EFAULT.
Jeff
--
Work email - jdike at linux dot intel dot com
next prev parent reply other threads:[~2008-04-28 15:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-25 17:56 [uml-devel] [PATCH 6/19] UML - hppfs fixes Jeff Dike
2008-04-25 17:56 ` Jeff Dike
2008-04-26 8:31 ` [uml-devel] " WANG Cong
2008-04-26 8:31 ` WANG Cong
2008-04-28 15:16 ` [uml-devel] " Jeff Dike
2008-04-28 15:16 ` Jeff Dike
2008-04-28 15:29 ` Jeff Dike [this message]
2008-04-28 15:29 ` Jeff Dike
2008-04-29 8:04 ` [uml-devel] " WANG Cong
2008-04-29 8:04 ` WANG Cong
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=20080428152940.GA7465@c2.user-mode-linux.org \
--to=jdike@addtoit.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=user-mode-linux-devel@lists.sourceforge.net \
--cc=xiyou.wangcong@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 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.