lkml.org 
[lkml]   [2011]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] lib: introduce strdup_from_user
From
On Fri, Jun 3, 2011 at 9:53 PM, Scott Wood <scottwood@freescale.com> wrote:
> On Fri, 3 Jun 2011 21:39:28 +0300
> Alexey Dobriyan <adobriyan@gmail.com> wrote:
>
>> On Fri, Jun 3, 2011 at 9:34 PM, Timur Tabi <timur@freescale.com> wrote:
>> > Would it be better if I did this:
>>
>> The point is data should cross kernelspace/userspace boundary only once.
>>
>
> Why does it matter, as long as it doesn't hurt the kernel if userspace
> plays games (i.e. take care of the NUL termination), and it's not a
> performance problem?

Because now you're lucky C strings are NUL-terminated.
If this "idiom" applies to some other case like "validate + copy",
we have a bug.

We copy data to kernelspace THEN validate or copy or whatever.
This is obviously correct and safe.


\
 
 \ /
  Last update: 2011-06-03 21:15    [W:0.321 / U:0.096 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site