summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/smartpqi
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2024-03-25 14:24:36 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2024-03-25 14:24:36 -0400
commit5fcc60dc74f0be95f6535c4a05d25491f0dae5dd (patch)
tree57b282fcc244137f89eba913a782c23a889b0709 /drivers/scsi/smartpqi
parentf02fe780f28db435671fcc7c0214556e253b5a46 (diff)
parent855ce06f9104e8b4b336807f3c941381bf845eb1 (diff)
downloadlinux-stable-5fcc60dc74f0be95f6535c4a05d25491f0dae5dd.tar.gz
linux-stable-5fcc60dc74f0be95f6535c4a05d25491f0dae5dd.tar.bz2
linux-stable-5fcc60dc74f0be95f6535c4a05d25491f0dae5dd.zip
Merge patch series "scsi: replace deprecated strncpy"
Justin Stitt <justinstitt@google.com> says: This series contains multiple replacements of strncpy throughout the scsi subsystem. strncpy() is deprecated for use on NUL-terminated destination strings [1] and as such we should prefer more robust and less ambiguous string interfaces. The details of each replacement will be in their respective patch. Link: https://lore.kernel.org/r/20240305-strncpy-drivers-scsi-mpi3mr-mpi3mr_fw-c-v3-0-5b78a13ff984@google.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/smartpqi')
-rw-r--r--drivers/scsi/smartpqi/smartpqi_init.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index 385180c98be4..bb15e0ac8fe4 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -1041,9 +1041,8 @@ static int pqi_write_driver_version_to_host_wellness(
buffer->driver_version_tag[1] = 'V';
put_unaligned_le16(sizeof(buffer->driver_version),
&buffer->driver_version_length);
- strncpy(buffer->driver_version, "Linux " DRIVER_VERSION,
- sizeof(buffer->driver_version) - 1);
- buffer->driver_version[sizeof(buffer->driver_version) - 1] = '\0';
+ strscpy(buffer->driver_version, "Linux " DRIVER_VERSION,
+ sizeof(buffer->driver_version));
buffer->dont_write_tag[0] = 'D';
buffer->dont_write_tag[1] = 'W';
buffer->end_tag[0] = 'Z';