diff options
author | Hao Chen <[email protected]> | 2023-06-21 20:33:08 +0800 |
---|---|---|
committer | Paolo Abeni <[email protected]> | 2023-06-23 10:59:17 +0200 |
commit | 1cf3d5567f273a8746d1bade00633a93204f80f0 (patch) | |
tree | 595ecace5c8f9020e12aa031777b88afeb107dc1 /tools/perf/scripts/python/syscall-counts-by-pid.py | |
parent | 9b476494da1aad70f4f083e853eb817bcb292d08 (diff) |
net: hns3: fix strncpy() not using dest-buf length as length issue
Now, strncpy() in hns3_dbg_fill_content() use src-length as copy-length,
it may result in dest-buf overflow.
This patch is to fix intel compile warning for csky-linux-gcc (GCC) 12.1.0
compiler.
The warning reports as below:
hclge_debugfs.c:92:25: warning: 'strncpy' specified bound depends on
the length of the source argument [-Wstringop-truncation]
strncpy(pos, items[i].name, strlen(items[i].name));
hclge_debugfs.c:90:25: warning: 'strncpy' output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
strncpy(pos, result[i], strlen(result[i]));
strncpy() use src-length as copy-length, it may result in
dest-buf overflow.
So,this patch add some values check to avoid this issue.
Signed-off-by: Hao Chen <[email protected]>
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/lkml/[email protected]/T/
Signed-off-by: Hao Lan <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/syscall-counts-by-pid.py')
0 files changed, 0 insertions, 0 deletions