linux/arch
Kees Cook e6584c3964 string: Allow 2-argument strscpy()
Using sizeof(dst) for the "size" argument in strscpy() is the
overwhelmingly common case. Instead of requiring this everywhere, allow a
2-argument version to be used that will use the sizeof() internally. There
are other functions in the kernel with optional arguments[1], so this
isn't unprecedented, and improves readability. Update and relocate the
kern-doc for strscpy() too, and drop __HAVE_ARCH_STRSCPY as it is unused.

Adjust ARCH=um build to notice the changed export name, as it doesn't
do full header includes for the string helpers.

This could additionally let us save a few hundred lines of code:
 1177 files changed, 2455 insertions(+), 3026 deletions(-)
with a treewide cleanup using Coccinelle:

@needless_arg@
expression DST, SRC;
@@

        strscpy(DST, SRC
-, sizeof(DST)
        )

Link: https://elixir.bootlin.com/linux/v6.7/source/include/linux/pci.h#L1517 [1]
Reviewed-by: Justin Stitt <justinstitt@google.com>
Cc: Andy Shevchenko <andy@kernel.org>
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
2024-02-20 20:47:32 -08:00
..
alpha RTC for 6.8 2024-01-18 17:25:39 -08:00
arc IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00
arm ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
arm64 ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
csky vfs-6.8.netfs 2024-01-19 09:10:23 -08:00
hexagon asm-generic cleanups for 6.8 2024-01-10 18:13:44 -08:00
loongarch LoongArch: KVM: Add returns to SIMD stubs 2024-01-26 16:22:07 +08:00
m68k percpu: 2024-01-18 15:01:28 -08:00
microblaze Microblaze patches for 6.8-rc1 2024-01-17 11:27:23 -08:00
mips ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
nios2 percpu: 2024-01-18 15:01:28 -08:00
openrisc
parisc ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
powerpc ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
riscv ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
s390 ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
sh kernel.h: removed REPEAT_BYTE from kernel.h 2024-02-01 09:47:59 -08:00
sparc sparc: Use device_get_match_data() 2024-01-19 08:08:53 -06:00
um string: Allow 2-argument strscpy() 2024-02-20 20:47:32 -08:00
x86 ubsan: Remove CONFIG_UBSAN_SANITIZE_ALL 2024-02-06 02:21:38 -08:00
xtensa percpu: 2024-01-18 15:01:28 -08:00
.gitignore
Kconfig IOMMU Updates for Linux v6.8 2024-01-18 15:16:57 -08:00