]>
Commit | Line | Data |
---|---|---|
be7e94f8 GKH |
1 | From foo@baz Thu Oct 18 11:11:32 CEST 2018 |
2 | From: Laura Abbott <labbott@redhat.com> | |
3 | Date: Tue, 11 Sep 2018 12:22:26 -0700 | |
4 | Subject: scsi: ibmvscsis: Ensure partition name is properly NUL terminated | |
5 | ||
6 | From: Laura Abbott <labbott@redhat.com> | |
7 | ||
8 | [ Upstream commit adad633af7b970bfa5dd1b624a4afc83cac9b235 ] | |
9 | ||
10 | While reviewing another part of the code, Kees noticed that the strncpy of the | |
11 | partition name might not always be NUL terminated. Switch to using strscpy | |
12 | which does this safely. | |
13 | ||
14 | Reported-by: Kees Cook <keescook@chromium.org> | |
15 | Signed-off-by: Laura Abbott <labbott@redhat.com> | |
16 | Reviewed-by: Kees Cook <keescook@chromium.org> | |
17 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
18 | Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> | |
19 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
20 | --- | |
21 | drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 2 +- | |
22 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
23 | ||
24 | --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | |
25 | +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | |
26 | @@ -3345,7 +3345,7 @@ static int ibmvscsis_probe(struct vio_de | |
27 | snprintf(vscsi->eye, sizeof(vscsi->eye), "VSCSI %s", vdev->name); | |
28 | ||
29 | vscsi->dds.unit_id = vdev->unit_address; | |
30 | - strncpy(vscsi->dds.partition_name, partition_name, | |
31 | + strscpy(vscsi->dds.partition_name, partition_name, | |
32 | sizeof(vscsi->dds.partition_name)); | |
33 | vscsi->dds.partition_num = partition_number; | |
34 |