lkml.org 
[lkml]   [2015]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: revert "fs/befs/linuxvfs.c: replace strncpy by strlcpy"
From
On Tue, Apr 28, 2015 at 2:38 PM, Chris Metcalf <cmetcalf@ezchip.com> wrote:
>
> To do that we'd probably want to provide a generic version that
> just copied byte-by-byte, and encourage architecture variants
> that were more efficient.

Our generic "strncpy_from_user()" is actually fairly efficient, and
reasonably portable. It almost has to be, since this is actually a
much more common - and much more critical - load than any regular
strncpy I know of in the kernel.

I suspect you could take that lib/strncpy_from_user.c and massage it
reasonably trivially to be a good function.

That said, I can't think of a single strncpy (or strlcpy) in kernel
space that is actually worth even optimizing for. They just don't tend
to be in the critical path. So correctness is likely *much* more
important than worrying about performance.

Linus


\
 
 \ /
  Last update: 2015-04-29 00:21    [W:0.171 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site