[PATCH] nvmet: replace strncpy with strscpy

Christoph Hellwig hch at lst.de
Wed Apr 2 21:27:37 PDT 2025


On Mon, Mar 31, 2025 at 09:47:28PM -0300, Marcelo Moreira wrote:
> strncpy() is deprecated due to its lack of NULL-termination
> guarantees and unnecessary zero-padding of the destination buffer.
> Use strscpy() instead.

Nothing explains here why it is deprecated and why the replacement
is better.  And why using memcpy or a seq_buf wasn't considered.

> Link: https://github.com/KSPP/linux/issues/90

And these kinds of links are actively harmful as the point a
commercial entity that can be taken down or changed at any time.
Don't do that.




More information about the Linux-nvme mailing list