On Tue, Dec 15, 2020 at 8:43 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote: > > From: Francis Laniel <laniel_francis@xxxxxxxxxxxxxxxxxxx> > Subject: string.h: add FORTIFY coverage for strscpy() > > The fortified version of strscpy ensures the following [..] So I've taken this, because it follows the pattern of what we already have, but I have to say that the "fortify" stuff is now about half of string.h. I think it should probably be split out into its own header file, and then string.h could just do #if !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && defined(CONFIG_FORTIFY_SOURCE) #include <linux/fortify-string.h> #endif or similar. That won't help my merge window build times (I build with allmodconfig, so I'll have CONFIG_FORTIFY_SOURCE=y and so my poor compiler will end up always going off and seeing all that every time somebody glances at string.h), but I think it would be a cleanup regardless. And people who _don't_ build with FORTIFY_SOURCE wouldn't have to read and parse that big chunk every time <linux/string.h> gets included. (And yes, just reading the source file and tokenizing it - even if it's all inside an #ifdef that turns off all the other phases - is actually quite noticeable overhead in a C compiler. Surprisingly so) Linus