linux/drivers/s390/scsi
Kees Cook 0d224b1088 scsi: zfcp: Replace strlcpy() with strscpy()
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>
2023-12-05 21:01:52 -05:00
..
Makefile
zfcp_aux.c scsi: zfcp: Fix a double put in zfcp_port_enqueue() 2023-09-27 11:31:20 -04:00
zfcp_ccw.c s390/zfcp: remove pm support from zfcp driver 2020-12-02 18:19:23 +01:00
zfcp_dbf.c scsi: zfcp: Trace when request remove fails after qdio send fails 2023-02-21 22:00:51 -05:00
zfcp_dbf.h
zfcp_def.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-02-21 22:00:51 -05: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 2022-07-07 17:33:58 -04:00
zfcp_erp.c
zfcp_ext.h scsi: zfcp: Trace when request remove fails after qdio send fails 2023-02-21 22:00:51 -05:00
zfcp_fc.c scsi: zfcp: Replace strlcpy() with strscpy() 2023-12-05 21:01:52 -05:00
zfcp_fc.h scsi: zfcp: Fix missing auto port scan and thus missing target ports 2022-08-01 19:50:00 -04:00
zfcp_fsf.c scsi: zfcp: Trace when request remove fails after qdio send fails 2023-02-21 22:00:51 -05:00
zfcp_fsf.h scsi: zfcp: Handle event-lost notification for Version Change events 2020-10-29 22:17:01 -04:00
zfcp_qdio.c s390/qdio: split do_QDIO() 2021-12-06 14:42:25 +01:00
zfcp_qdio.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-02-21 22:00:51 -05:00
zfcp_reqlist.h scsi: zfcp: Change the type of all fsf request id fields and variables to u64 2023-02-21 22:00:51 -05:00
zfcp_scsi.c scsi: zfcp: Declare SCSI host template const 2023-03-24 19:19:20 -04:00
zfcp_sysfs.c scsi: zfcp: Declare zfcp_sdev_attrs as static 2022-07-07 17:33:58 -04:00
zfcp_unit.c scsi: zfcp: fix kernel doc comments 2021-09-08 14:23:31 +02:00