[PATCH v2] nvmet: do not copy beyond sybsysnqn string length
Max Gurtovoy
mgurtovoy at nvidia.com
Sat Jan 10 14:14:49 PST 2026
> drivers/nvme/target/passthru.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/passthru.c b/drivers/nvme/target/passthru.c
> index 96648ec2fadb..67c423a8b052 100644
> --- a/drivers/nvme/target/passthru.c
> +++ b/drivers/nvme/target/passthru.c
> @@ -150,7 +150,7 @@ static u16 nvmet_passthru_override_id_ctrl(struct nvmet_req *req)
> * code path with duplicate ctrl subsysnqn. In order to prevent that we
> * mask the passthru-ctrl subsysnqn with the target ctrl subsysnqn.
> */
> - memcpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn));
> + strscpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn));
>
> /* use fabric id-ctrl values */
> id->ioccsz = cpu_to_le32((sizeof(struct nvme_command) +
Looks good,
Reviewed-by: Max Gurtovoy <mgurtovoy at nvidia.com>
More information about the Linux-nvme
mailing list