Re: revert "fs/befs/linuxvfs.c: replace strncpy by strlcpy"
From: Linus Torvalds
Date: Tue Apr 28 2015 - 17:48:58 EST
On Tue, Apr 28, 2015 at 2:38 PM, Chris Metcalf <cmetcalf@xxxxxxxxxx> 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.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/