Re: [PATCH] nvme: Removing deprecated strncpy()

From: Caleb Sander Mateos
Date: Tue Apr 15 2025 - 10:39:44 EST


On Mon, Apr 14, 2025 at 5:37 PM Kevin Paul Reddy Janagari
<kevinpaul468@xxxxxxxxx> wrote:
>
> This patch suggests the replacement of strncpy with strscpy
> as per Documentation/process/deprecated.
> The strncpy() fails to guarantee NULL termination,
> The function adds zero pads which isn't really convenient for short strings
> as it may cause performance issues.
>
> strscpy() is a preferred replacement because
> it overcomes the limitations of strncpy mentioned above.

This patch was posted to the mailing list earlier:
https://lists.infradead.org/pipermail/linux-nvme/2025-April/055004.html

Best,
Caleb