arm64/sysreg: Fix broken strncpy() -> strscpy() conversion
authorWill Deacon <will@kernel.org>
Wed, 6 Sep 2023 18:15:37 +0000 (19:15 +0100)
committerWill Deacon <will@kernel.org>
Wed, 6 Sep 2023 18:22:54 +0000 (19:22 +0100)
commitab41a97474c00ceab1b8f44ac78a51079130466a
treeb14e2a62d12fe8c4d7d5a9557c3a6095ea828857
parent7625df9f4b255eb9d56885e25c564d7e794c6da1
arm64/sysreg: Fix broken strncpy() -> strscpy() conversion

Mostafa reports that commit d232606773a0 ("arm64/sysreg: refactor
deprecated strncpy") breaks our early command-line parsing because the
original code is working on space-delimited substrings rather than
NUL-terminated strings.

Rather than simply reverting the broken conversion patch, replace the
strscpy() with a simple memcpy() with an explicit NUL-termination of the
result.

Reported-by: Mostafa Saleh <smostafa@google.com>
Tested-by: Mostafa Saleh <smostafa@google.com>
Fixes: d232606773a0 ("arm64/sysreg: refactor deprecated strncpy")
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20230905-strncpy-arch-arm64-v4-1-bc4b14ddfaef@google.com
Link: https://lore.kernel.org/r/20230831162227.2307863-1-smostafa@google.com
Signed-off-by: Will Deacon <will@kernel.org>
arch/arm64/kernel/idreg-override.c