RISC-V: cpu: refactor deprecated strncpy
authorJustin Stitt <justinstitt@google.com>
Wed, 2 Aug 2023 00:21:58 +0000 (00:21 +0000)
committerPalmer Dabbelt <palmer@rivosinc.com>
Wed, 2 Aug 2023 20:45:28 +0000 (13:45 -0700)
commit12d61a1bc28eef8d799ba00f370f421f7e942629
tree0a0fd3ba74220d0feafb83bf81cb98030138399c
parent54670b59cfab843671ecc6a92d9e0fda20174df0
RISC-V: cpu: refactor deprecated strncpy

`strncpy` is deprecated for use on NUL-terminated destination strings [1].

Favor not copying strings onto stack and instead use strings directly.
This avoids hard-coding sizes and buffer lengths all together.

Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Palmer Dabbelt <palmer@rivosinc.com>
Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230802-arch-riscv-kernel-v2-1-24266e85bc96@google.com
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/cpu.c