linux/drivers/scsi/mpt3sas
Kees Cook adb77bba9c scsi: mpt3sas: Avoid possible run-time warning with long manufacturer strings
The prior strscpy() replacement of strncpy() here expected the
manufacture_reply strings to be NUL-terminated, but it is possible
they are not, as the code pattern here shows, e.g., edev->vendor_id
being exactly 1 character larger than manufacture_reply->vendor_id,
and the replaced strncpy() was copying only up to the size of the
source character array. Replace this with memtostr(), which is the
unambiguous way to convert a maybe not-NUL-terminated character array
into a NUL-terminated string.

Fixes: b7e9712a02 ("scsi: mpt3sas: Replace deprecated strncpy() with strscpy()")
Signed-off-by: Kees Cook <keescook@chromium.org>
Tested-by: Marco Patalano <mpatalan@redhat.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240410023155.2100422-3-keescook@chromium.org
Signed-off-by: Kees Cook <kees@kernel.org>
2024-05-31 08:58:20 -07:00
..
mpi scsi: mpt3sas: Fix an outdated comment 2023-11-15 08:52:02 -05:00
Kconfig scsi: mpt3sas: Fix spelling mistake in Kconfig "compatiblity" -> "compatibility" 2021-01-05 23:25:07 -05:00
Makefile scsi: mpt3sas: Capture IOC data for debugging purposes 2020-05-07 22:24:27 -04:00
mpt3sas_base.c scsi: mpt3sas: Avoid possible run-time warning with long manufacturer strings 2024-05-31 08:58:20 -07:00
mpt3sas_base.h scsi: mpt3sas: Update driver version to 48.100.00.00 2024-01-24 21:40:26 -05:00
mpt3sas_config.c scsi: mpt3sas: Fix typo of "TRIGGER" 2023-11-15 08:52:02 -05:00
mpt3sas_ctl.c scsi: mpt3sas: Reload SBR without rebooting HBA 2024-01-24 21:40:26 -05:00
mpt3sas_ctl.h scsi: mpt3sas: Reload SBR without rebooting HBA 2024-01-24 21:40:26 -05:00
mpt3sas_debug.h
mpt3sas_debugfs.c scsi: mpt3sas: Remove unused including <linux/version.h> 2020-05-11 23:09:21 -04:00
mpt3sas_scsih.c scsi: mpt3sas: Switch to using ->device_configure 2024-04-11 21:37:49 -04:00
mpt3sas_transport.c scsi: mpt3sas: Avoid possible run-time warning with long manufacturer strings 2024-05-31 08:58:20 -07:00
mpt3sas_trigger_diag.c scsi: mpt3sas: Additional diagnostic buffer query interface 2021-02-08 22:02:07 -05:00
mpt3sas_trigger_diag.h scsi: mpt3sas: Fix spelling mistake 2020-06-15 23:28:46 -04:00
mpt3sas_trigger_pages.h scsi: mpt3sas: Fix typo of "TRIGGER" 2023-11-15 08:52:02 -05:00
mpt3sas_warpdrive.c scsi: mpt3sas: Use struct_size() for struct size calculations 2023-11-15 08:52:02 -05:00