powerpc/ps3: refactor strncpy usage
authorJustin Stitt <justinstitt@google.com>
Wed, 16 Aug 2023 21:39:24 +0000 (21:39 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 18 Aug 2023 01:48:42 +0000 (11:48 +1000)
commitf94a84a0914841d79a38df7cc75512d88b31a0dc
tree9507c09d98e1f827c5e346358cbcb890733debdc
parent9a32584bc108c8fe4d02fa33b16caf686e4a788a
powerpc/ps3: refactor strncpy usage

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

`make_first_field()` should use similar implementation to `make_field()`
due to memcpy having more obvious behavior here. The end result yields
the same behavior as the previous `strncpy`-based implementation
including the NUL-padding.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Link: https://github.com/KSPP/linux/issues/90
Signed-off-by: Justin Stitt <justinstitt@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Geoff Levand <geoff@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230816-strncpy-arch-powerpc-platforms-ps3-repository-v1-1-88283b02fb09@google.com
arch/powerpc/platforms/ps3/repository.c