soc: fsl: qe: Replace all non-returning strlcpy with strscpy
authorAzeem Shaikh <azeemshaikh38@gmail.com>
Tue, 23 May 2023 02:14:25 +0000 (02:14 +0000)
committerKees Cook <keescook@chromium.org>
Mon, 17 Jul 2023 23:05:20 +0000 (16:05 -0700)
commit8453e7924a1a9130f2b4d2c507de2cdc3892a5b5
treea5d4acca5cf3e80e28ba88e0fc4ee92c2908fc34
parentce6616724fb425d6043d0dad6af996cd7c79bcc4
soc: fsl: qe: Replace all non-returning strlcpy with strscpy

strlcpy() reads the entire source buffer first.
This read may exceed the destination size limit.
This is both inefficient and can lead to linear read
overflows if a source string is not NUL-terminated [1].
In an effort to remove strlcpy() completely [2], replace
strlcpy() here with strscpy().
No return values were used, so direct replacement is safe.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89

Signed-off-by: Azeem Shaikh <azeemshaikh38@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20230523021425.2406309-1-azeemshaikh38@gmail.com
Signed-off-by: Kees Cook <keescook@chromium.org>
drivers/soc/fsl/qe/qe.c