Re: [PATCH] scsi: target: Replace strncpy() with strscpy() in VPD dump functions

From: Martin K. Petersen

Date: Thu Apr 02 2026 - 22:08:18 EST


On Mon, 23 Mar 2026 10:13:15 -0700, Kees Cook wrote:

> Replace the deprecated[1] strncpy() with strscpy() in
> transport_dump_vpd_proto_id(), transport_dump_vpd_assoc(),
> transport_dump_vpd_ident_type(), and transport_dump_vpd_ident().
>
> All four functions follow the same pattern: a local
> buf[VPD_TMP_BUF_SIZE] (254 bytes) is zeroed with memset(), populated
> via sprintf()/snprintf() (always NUL-terminated), then conditionally
> copied to p_buf with strncpy(). The p_buf destination is used as a
> C string by all callers in target_core_configfs.c: strlen(buf) and
> sprintf(page+len, "%s", buf) to build sysfs output.
>
> [...]

Applied to 7.1/scsi-queue, thanks!

[1/1] scsi: target: Replace strncpy() with strscpy() in VPD dump functions
https://git.kernel.org/mkp/scsi/c/665fb6a64319

--
Martin K. Petersen