summaryrefslogtreecommitdiff
path: root/drivers/scsi/mpi3mr
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2024-04-10 05:31:51 +0300
committerKees Cook <keescook@chromium.org>2024-04-25 20:41:19 +0300
commit5bb288c4abc2e67d4ea94ba6bc80bb0ab18b123e (patch)
tree7a9b13fccdcb3968cda1505a8d25d0207412249d /drivers/scsi/mpi3mr
parentf700b71927017ca5697e8a24fd2ad5d3e06489d6 (diff)
downloadlinux-5bb288c4abc2e67d4ea94ba6bc80bb0ab18b123e.tar.xz
scsi: mptfusion: 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. Reported-by: Charles Bertsch <cbertsch@cox.net> Closes: https://lore.kernel.org/all/5445ba0f-3e27-4d43-a9ba-0cc22ada2fce@cox.net/ Fixes: 45e833f0e5bb ("scsi: message: fusion: Replace deprecated strncpy() with strscpy()") Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20240410023155.2100422-2-keescook@chromium.org Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'drivers/scsi/mpi3mr')
0 files changed, 0 insertions, 0 deletions