lkml.org 
[lkml]   [2008]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 6/19] UML - hppfs fixes
    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


    \
     
     \ /
      Last update: 2008-04-28 17:39    [W:0.020 / U:149.220 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site