diff options
author | Justin Stitt <justinstitt@google.com> | 2024-03-06 02:34:40 +0300 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-03-11 01:37:43 +0300 |
commit | 1b60c86dd9928688469a9dd09582538aead85d32 (patch) | |
tree | 42dd91502cfdce6b7ba8fa7515ab2869553877b2 /scripts/lib/kdoc/kdoc_files.py | |
parent | 4f94864d210f31d9247e5189b2af368dcc05c395 (diff) | |
download | linux-1b60c86dd9928688469a9dd09582538aead85d32.tar.xz |
scsi: devinfo: Replace strncpy() and manual pad
Depending on the state of @compatible, we are going to do different things
with our @to buffer.
When @compatible is true we want a NUL-term'd and NUL-padded destination
buffer. Conversely, if @compatible is false we just want a space-padded
destination buffer (no NUL-term required).
As per:
/**
* scsi_dev_info_list_add_keyed - add one dev_info list entry.
* @compatible: if true, null terminate short strings. Otherwise space pad.
...
Note that we can't easily use strtomem_pad() here as the size of the @to
buffer is unknown to the compiler due to indirection layers.
Now, the intent of the code is more clear (I probably didn't even need
to add a comment -- that's how clear it is).
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20240305-strncpy-drivers-scsi-mpi3mr-mpi3mr_fw-c-v3-5-5b78a13ff984@google.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions