On Tue, Aug 18, 2020 at 08:32:58PM -0700, Linus Torvalds wrote: > On Tue, Aug 18, 2020 at 8:04 PM Arvind Sankar <nived...@alum.mit.edu> wrote: > > > Might be worth optimizing strnlen etc with the word-at-a-time thing though. > > Yeah, possibly. Except the kernel almost never uses strnlen for > anything bigger. At least I haven't seen it very much in the profiles.
strscpy could be implemented as strnlen+memcpy. I'd think that wouldn't be much slower, especially if strnlen is optimized and the arch has a good implementation of memcpy?