Re: [RFC] [QUESTION] Stuff to do for string

From: Kees Cook

Date: Wed Apr 22 2026 - 19:16:39 EST




On April 22, 2026 12:23:47 PM PDT, Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
>On Wed, Apr 22, 2026 at 05:56:38PM +0100, Josh Law wrote:
>> On 22 April 2026 17:51:40 BST, Andy Shevchenko
>> <andriy.shevchenko@xxxxxxxxx> wrote:
>> >On Wed, Apr 22, 2026 at 05:28:39PM +0100, Josh Law wrote:
>> >> On 22 April 2026 17:12:37 BST, Andy Shevchenko
>> >> <andriy.shevchenko@xxxxxxxxx> wrote:
>> >> >On Wed, Apr 22, 2026 at 03:57:16PM +0100, Josh Law wrote:
>> >> >> Hello, (this is my first RFC, so maybe cc is bad, but yeah)
>> >> >>
>> >> >> What do you guys have planned/would like me to have a look at doing
>> >in
>> >> >> lib/string.c
>> >> >>
>> >> >> I am home from school so I am virtually free
>> >> >
>> >> >Arbitrary things that came to my mind (no particular order)
>> >> >
>> >> >- Get rid of strlcat()
>> >>
>> >> Yeah, I'm working on that actually :D, privately, I sorta stopped cuz i
>> >> thought kees was gonna do that, if not, not issue!
>> >>
>> >> >- Clean up include/linux/string.h
>> >> > a) drop extern for functions
>> >> > b) put the headers it includes into an order and follow IWYU
>> >>
>> >> Hmm, yeah, I see it's kind of a mess (in a polite way)
>> >>
>> >> >- kill memscan() in favour of memchr() / memchr_inv()
>> >>
>> >> Hmm, maybe, is there a crazy amount of files that call memscan()?
>> >
>> >You can find an answer yourself. The daily-basis kill feature tool is
>> >`git grep ...`.
>>
>> Oh, yes, I see this now, I should be able to do this, gotta slap the
>> computer awake cuz sometimes it breaks. So it may take time for me
>> to submit it, would you like a treewide cleanup, or subsystem by subsystem
>
>It depends case by case. As Kees' patch shows in some cases it may touch too
>many things to be treewide and has to be subsystem / driver focused.

Traditionally, patches for these kinds of changes (i.e. strlcat) get split per subsystem or per driver, since they're not 1:1 mechanical conversions.

And while I did a couple conversions recently (since I was already looking at the code), it's not on my active TODO right now. Feel free to tackle it!

You can reference https://github.com/KSPP/linux/issues/370 with a Link tag too.

-Kees

--
Kees Cook