Re: [RFC] Precarious macro in tools/include/linux/string.h

From: Wei Yang

Date: Tue May 05 2026 - 23:37:11 EST


On Mon, May 04, 2026 at 11:21:35PM -0500, Maxwell Doose wrote:
>Hello Wei and Mike,
>
>I was recently helping a new contributor with their patch replacing
>strcpy() with strscpy() in tools/gpio. After some research I put a
>hold on that and realized that strscpy was defined as strcpy, which is
>extremely precarious and goes against the ideas the kernel has been
>fighting for for years, and I traced that change back to commit
>9e3d665 authored by Wei and merged by Mike. I'm currently working with
>said contributor to get this alias removed and the proper function
>definition added, just wanted to give you a heads up.

Thanks for the effort.

>
>Are there any tools or dependencies that rely on strscpy() being
>aliased to strcpy() before we replace it with the real definition?
>

The alias is introduced to fix the test case in tools/testing/memblock, since
reserved_mem_add() use strscpy() but there is no definition in tools/.

So replace the alias with proper function definition looks good to me.

>best regards,
>max

--
Wei Yang
Help you, Help me