linux-stable/drivers/scsi/csiostor
Justin Stitt 4592411784 scsi: csiostor: Replace deprecated strncpy() with strscpy()
strncpy() is deprecated for use on NUL-terminated destination strings [1]
and as such we should prefer more robust and less ambiguous string
interfaces.

'hw' is kzalloc'd just before this string assignment:
|       hw = kzalloc(sizeof(struct csio_hw), GFP_KERNEL);

... which means any NUL-padding is redundant.

Since CSIO_DRV_VERSION is a small string literal (smaller than
sizeof(dest)):

... there is functionally no change in this swap from strncpy() to
strscpy(). Nonetheless, let's make the change for robustness' sake -- as
it will ensure that drv_version is _always_ NUL-terminated.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1]
Link: https://github.com/KSPP/linux/issues/90
Cc: linux-hardening@vger.kernel.org
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20231023-strncpy-drivers-scsi-csiostor-csio_init-c-v1-1-5ea445b56864@google.com
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-11-15 09:05:46 -05:00
..
csio_attr.c
csio_defs.h
csio_hw.c
csio_hw.h
csio_hw_chip.h
csio_hw_t5.c
csio_init.c scsi: csiostor: Replace deprecated strncpy() with strscpy() 2023-11-15 09:05:46 -05:00
csio_init.h
csio_isr.c
csio_lnode.c scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn() 2021-10-12 12:10:34 -04:00
csio_lnode.h
csio_mb.c
csio_mb.h
csio_rnode.c
csio_rnode.h
csio_scsi.c scsi: csiostor: Convert sysfs snprintf() to sysfs_emit() 2022-09-15 22:35:21 -04:00
csio_scsi.h scsi: csio: Stop using the SCSI pointer 2022-02-22 21:11:04 -05:00
csio_wr.c scsi: csiostor: Remove unused variable 'n' 2022-11-08 03:40:54 +00:00
csio_wr.h
Kconfig
Makefile
t4fw_api_stor.h