Re: [PATCH] md: replace deprecated strncpy with memcpy

From: Song Liu
Date: Tue Sep 26 2023 - 20:03:09 EST


On Mon, Sep 25, 2023 at 11:22 AM Kees Cook <keescook@xxxxxxxxxxxx> wrote:
>
[...]
> >
> > So really, all these instances have precisely calculated lengths and
> > purposeful NUL-termination so we can just use memcpy to remove ambiguity
> > surrounding strncpy.
> >
> > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
> > Link: https://github.com/KSPP/linux/issues/90
> > Cc: linux-hardening@xxxxxxxxxxxxxxx
> > Signed-off-by: Justin Stitt <justinstitt@xxxxxxxxxx>
>
> I agree on the analysis of the replacements. Thanks for all the detail!
>
> Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Applied to md-next. Thanks!

Song