diff options
| author | Kees Cook <[email protected]> | 2024-04-10 02:31:52 +0000 |
|---|---|---|
| committer | Kees Cook <[email protected]> | 2024-05-31 15:58:20 +0000 |
| commit | adb77bba9c664f5d120e0ffb1387e9d7408e1529 (patch) | |
| tree | c75ba2e0d292eea7401491fef8cf5b78268c34ad /drivers/usb/cdns3/cdns3-ti.c | |
| parent | Linux 6.10-rc1 (diff) | |
| download | kernel-adb77bba9c664f5d120e0ffb1387e9d7408e1529.tar.gz kernel-adb77bba9c664f5d120e0ffb1387e9d7408e1529.zip | |
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: b7e9712a02e8 ("scsi: mpt3sas: Replace deprecated strncpy() with strscpy()")
Signed-off-by: Kees Cook <[email protected]>
Tested-by: Marco Patalano <[email protected]>
Reviewed-by: Ewan D. Milne <[email protected]>
Reviewed-by: Martin K. Petersen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Kees Cook <[email protected]>
Diffstat (limited to 'drivers/usb/cdns3/cdns3-ti.c')
0 files changed, 0 insertions, 0 deletions
