Centos-kernel-stream-9/drivers/s390/scsi
Tobias Huschle 62504da87e scsi: zfcp: Replace strlcpy() with strscpy()
JIRA: https://issues.redhat.com/browse/RHEL-23680
Upstream status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Tested: by IBM
Build-Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=61608095
Conflicts: None

commit 0d224b1088afef95f7069b7ca907cb199a5802ff

    strlcpy() reads the entire source buffer first. This read may exceed the
    destination size limit. This is both inefficient and can lead to linear
    read overflows if a source string is not NUL-terminated[1].  Additionally,
    it returns the size of the source string, not the resulting size of the
    destination string. In an effort to remove strlcpy() completely[2], replace
    strlcpy() here with strscpy().

    Overflow should be impossible here, but actually check for buffer sizes
    being identical with BUILD_BUG_ON(), and include a run-time check as well.

    Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy [1]
    Link: https://github.com/KSPP/linux/issues/89 [2]
    Cc: Martin K. Petersen <martin.petersen@oracle.com>
    Cc: James E.J. Bottomley <jejb@linux.ibm.com>
    Cc: Steffen Maier <maier@linux.ibm.com>
    Cc: Benjamin Block <bblock@linux.ibm.com>
    Cc: Heiko Carstens <hca@linux.ibm.com>
    Cc: Vasily Gorbik <gor@linux.ibm.com>
    Cc: Alexander Gordeev <agordeev@linux.ibm.com>
    Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
    Cc: Sven Schnelle <svens@linux.ibm.com>
    Cc: Azeem Shaikh <azeemshaikh38@gmail.com>
    Cc: <linux-s390@vger.kernel.org>
    Cc: <linux-scsi@vger.kernel.org>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/r/20231130204056.it.978-kees@kernel.org
    Acked-by: Benjamin Block <bblock@linux.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

Signed-off-by: Tobias Huschle <thuschle@redhat.com>
2024-05-31 10:03:00 +00:00
..
Makefile
zfcp_aux.c scsi: zfcp: Fix a double put in zfcp_port_enqueue() 2024-05-31 10:02:59 +00:00
zfcp_ccw.c
zfcp_dbf.c scsi: zfcp: Trace when request remove fails after qdio send fails 2023-05-12 07:29:20 +00:00
zfcp_dbf.h
zfcp_def.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-05-12 07:29:19 +00:00
zfcp_diag.c scsi: zfcp: Clean up sysfs code for SFP diagnostics 2021-04-15 22:19:40 -04:00
zfcp_diag.h scsi: zfcp: Drop redundant "the" in the comments 2023-05-12 07:29:19 +00:00
zfcp_erp.c
zfcp_ext.h scsi: zfcp: Trace when request remove fails after qdio send fails 2023-05-12 07:29:20 +00:00
zfcp_fc.c scsi: zfcp: Replace strlcpy() with strscpy() 2024-05-31 10:03:00 +00:00
zfcp_fc.h scsi: zfcp: Fix missing auto port scan and thus missing target ports 2022-08-26 15:19:59 +00:00
zfcp_fsf.c scsi: zfcp: Trace when request remove fails after qdio send fails 2023-05-12 07:29:20 +00:00
zfcp_fsf.h
zfcp_qdio.c [s390] s390/qdio: split do_QDIO() 2022-06-08 06:03:11 -04:00
zfcp_qdio.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-05-12 07:29:19 +00:00
zfcp_reqlist.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-05-12 07:29:19 +00:00
zfcp_scsi.c scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-05-12 07:29:19 +00:00
zfcp_sysfs.c scsi: zfcp: Report port fc_security as unknown early during remote cable pull 2021-07-12 21:51:50 -04:00
zfcp_unit.c [s390] scsi: zfcp: fix kernel doc comments 2022-06-08 06:03:07 -04:00