diff options
| author | Yuntao Wang <[email protected]> | 2022-03-04 07:04:08 +0000 |
|---|---|---|
| committer | Andrii Nakryiko <[email protected]> | 2022-03-08 06:04:33 +0000 |
| commit | 03b9c7fa3f15f51bcd07f3828c2a01311e7746c4 (patch) | |
| tree | 0c06340fc7c23e7edcaec27e902d871fd1183cc9 /tools/lib/bpf/bpf.c | |
| parent | libbpf: Unmap rings when umem deleted (diff) | |
| download | kernel-03b9c7fa3f15f51bcd07f3828c2a01311e7746c4.tar.gz kernel-03b9c7fa3f15f51bcd07f3828c2a01311e7746c4.zip | |
bpf: Replace strncpy() with strscpy()
Using strncpy() on NUL-terminated strings is considered deprecated[1].
Moreover, if the length of 'task->comm' is less than the destination buffer
size, strncpy() will NUL-pad the destination buffer, which is a needless
performance penalty.
Replacing strncpy() with strscpy() fixes all these issues.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Signed-off-by: Yuntao Wang <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Acked-by: Yonghong Song <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/bpf.c')
0 files changed, 0 insertions, 0 deletions
