diff options
author | 2024-04-09 19:31:54 -0700 | |
---|---|---|
committer | 2024-04-25 10:41:47 -0700 | |
commit | c3408c4ae041dcc6a302397099fcad0dc307f6fd (patch) | |
tree | 7c68dba491eb5838d10271afd51e08176675582e /tools/perf/scripts/python/call-graph-from-postgresql.py | |
parent | scsi: mpi3mr: Avoid possible run-time warning with long manufacturer strings (diff) | |
download | wireguard-linux-c3408c4ae041dcc6a302397099fcad0dc307f6fd.tar.xz wireguard-linux-c3408c4ae041dcc6a302397099fcad0dc307f6fd.zip |
scsi: qla2xxx: Avoid possible run-time warning with long model_num
The prior strlcpy() replacement of strncpy() here (which was
later replaced with strscpy()) expected pinfo->model_num (and
pinfo->model_description) to be NUL-terminated, but it is possible
it was not, as the code pattern here shows vha->hw->model_number (and
vha->hw->model_desc) being exactly 1 character larger, 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: 527e9b704c3d ("scsi: qla2xxx: Use memcpy() and strlcpy() instead of strcpy() and strncpy()")
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240410023155.2100422-5-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'tools/perf/scripts/python/call-graph-from-postgresql.py')
0 files changed, 0 insertions, 0 deletions