Re: [PATCH v2 1/7] scsi: mpi3mr: replace deprecated strncpy with assignments

From: Kees Cook
Date: Wed Feb 28 2024 - 19:02:58 EST


On Wed, Feb 28, 2024 at 10:59:01PM +0000, Justin Stitt wrote:
> Really, there's no bug with the current code. Let's just ditch strncpy()
> all together.
>
> We can just copy the const strings instead of reserving room on the
> stack.
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> Link: https://manpages.debian.org/testing/linux-manual-4.8/strscpy.9.en.html [2]
> Link: https://github.com/KSPP/linux/issues/90
> Cc: linux-hardening@xxxxxxxxxxxxxxx
> Signed-off-by: Justin Stitt <justinstitt@xxxxxxxxxx>

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

--
Kees Cook