summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ibmvscsi_tgt
diff options
context:
space:
mode:
authorLaura Abbott <labbott@redhat.com>2018-09-11 12:22:26 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2018-09-17 02:50:37 -0400
commitadad633af7b970bfa5dd1b624a4afc83cac9b235 (patch)
tree9865d48ff5f4c89aa9ed5b667df10e41f7195f3c /drivers/scsi/ibmvscsi_tgt
parentd792d4c4fc866ae224b0b0ca2aabd87d23b4d6cc (diff)
downloadlinux-adad633af7b970bfa5dd1b624a4afc83cac9b235.tar.bz2
scsi: ibmvscsis: Ensure partition name is properly NUL terminated
While reviewing another part of the code, Kees noticed that the strncpy of the partition name might not always be NUL terminated. Switch to using strscpy which does this safely. Reported-by: Kees Cook <keescook@chromium.org> Signed-off-by: Laura Abbott <labbott@redhat.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/ibmvscsi_tgt')
-rw-r--r--drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index b3a029ad07cd..f42a619198c4 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -3477,7 +3477,7 @@ static int ibmvscsis_probe(struct vio_dev *vdev,
snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name);
vscsi->dds.unit_id = vdev->unit_address;
- strncpy(vscsi->dds.partition_name, partition_name,
+ strscpy(vscsi->dds.partition_name, partition_name,
sizeof(vscsi->dds.partition_name));
vscsi->dds.partition_num = partition_number;