aboutsummaryrefslogtreecommitdiffstats
path: root/samples/rust/rust_driver_pci.rs
diff options
context:
space:
mode:
authorThorsten Blum <[email protected]>2025-03-13 13:30:02 +0000
committerAndrew Morton <[email protected]>2025-03-17 19:17:01 +0000
commit6164be01f1799458b5c6f59a547d6241e4a4b4d6 (patch)
tree82517046ea8d1a5f8c51bfaf95e1fc81e8867a28 /samples/rust/rust_driver_pci.rs
parentlib/interval_tree: fix the comment of interval_tree_span_iter_next_gap() (diff)
downloadkernel-6164be01f1799458b5c6f59a547d6241e4a4b4d6.tar.gz
kernel-6164be01f1799458b5c6f59a547d6241e4a4b4d6.zip
watchdog/perf: optimize bytes copied and remove manual NUL-termination
Currently, up to 23 bytes of the source string are copied to the destination buffer (including the comma and anything after it), only to then manually NUL-terminate the destination buffer again at index 'len' (where the comma was found). Fix this by calling strscpy() with 'len' instead of the destination buffer size to copy only as many bytes from the source string as needed. Change the length check to allow 'len' to be less than or equal to the destination buffer size to fill the whole buffer if needed. Remove the if-check for the return value of strscpy(), because calling strscpy() with 'len' always truncates the source string at the comma as expected and NUL-terminates the destination buffer at the corresponding index instead. Remove the manual NUL-termination. No functional changes intended. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Thorsten Blum <[email protected]> Cc: Song Liu <[email protected]> Cc: Thomas Gleinxer <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'samples/rust/rust_driver_pci.rs')
0 files changed, 0 insertions, 0 deletions