diff options
author | Kees Cook <keescook@chromium.org> | 2024-04-09 19:31:52 -0700 |
---|---|---|
committer | Kees Cook <kees@kernel.org> | 2024-05-31 08:58:20 -0700 |
commit | adb77bba9c664f5d120e0ffb1387e9d7408e1529 (patch) | |
tree | c75ba2e0d292eea7401491fef8cf5b78268c34ad /drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c | |
parent | 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0 (diff) |
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 <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>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_vm_pt.c')
0 files changed, 0 insertions, 0 deletions