lkml.org 
[lkml]   [2006]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] adjust /dev/{kmem,mem,port} write handlers
>> @@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * 
>> if (len) {
>> written = copy_from_user(kbuf, buf, len);
>> if (written) {
>> - ssize_t ret;
>> -
>> + if (wrote + virtr)
>> + break;
>> free_page((unsigned long)kbuf);
>> - ret = wrote + virtr + (len - written);
>> - return ret ? ret : -EFAULT;
>> + return -EFAULT;
>> }
>> }
>> len = vwrite(kbuf, (char *)p, len);
>
>
>I think write_kmem() still isn't quie right - it needs to update `p' (and
>hence *ppos) to account for a partial copy_from_user(). (Please double-check)

No, I disagree. The actual write happens with the call to vwrite(), independent of the reading of the user buffer. If
any adjustment might be needed, then it would be to account for the potential of vwrite() (and similarly vread()) to
return 0, resulting in no progress being possible to be made anymore.

Jan
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-06 13:12    [W:0.053 / U:2.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site