lkml.org 
[lkml]   [2006]   [Mar]   [6]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateMon, 06 Mar 2006 09:08:44 +0100
From"Jan Beulich" <>
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 12:12    [from the cache]
©2003-2008