[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.00.0804291604380.2548@localhost.localdomain>
Date: Tue, 29 Apr 2008 16:04:56 +0800 (CST)
From: WANG Cong <xiyou.wangcong@...il.com>
To: Jeff Dike <jdike@...toit.com>
cc: WANG Cong <xiyou.wangcong@...il.com>, akpm@...l.org,
linux-kernel@...r.kernel.org,
user-mode-linux-devel@...ts.sourceforge.net
Subject: Re: [PATCH 6/19] UML - hppfs fixes
On Mon, 28 Apr 2008, Jeff Dike wrote:
> 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.
Yes, thanks.
--
Hi, I'm a .signature virus, please copy/paste me to help me spread
all over the world.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists