mirror_ubuntu-kernels/drivers/net/ethernet/hisilicon/hns3
Hao Chen 5e3d20617b net: hns3: fix strscpy causing content truncation issue
hns3_dbg_fill_content()/hclge_dbg_fill_content() is aim to integrate some
items to a string for content, and we add '\n' and '\0' in the last
two bytes of content.

strscpy() will add '\0' in the last byte of destination buffer(one of
items), it result in finishing content print ahead of schedule and some
dump content truncation.

One Error log shows as below:
cat mac_list/uc
UC MAC_LIST:

Expected:
UC MAC_LIST:
FUNC_ID  MAC_ADDR            STATE
pf       00:2b:19:05:03:00   ACTIVE

The destination buffer is length-bounded and not required to be
NUL-terminated, so just change strscpy() to memcpy() to fix it.

Fixes: 1cf3d5567f ("net: hns3: fix strncpy() not using dest-buf length as length issue")
Signed-off-by: Hao Chen <chenhao418@huawei.com>
Signed-off-by: Jijie Shao <shaojijie@huawei.com>
Link: https://lore.kernel.org/r/20230809020902.1941471-1-shaojijie@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-08-10 11:47:56 -07:00
..
hns3_common net: hns3: add tm flush when setting tm 2023-07-24 09:36:23 +01:00
hns3pf net: hns3: fix strscpy causing content truncation issue 2023-08-10 11:47:56 -07:00
hns3vf net: hns3: clear hns unused parameter alarm 2023-06-23 10:59:17 +02:00
hclge_mbx.h net: hns3: refactor function hclge_mbx_handler() 2022-09-21 14:32:21 -07:00
hnae3.c net: hns3: disable sriov before unload hclge layer 2021-10-20 11:38:11 +01:00
hnae3.h net: hns3: add tm flush when setting tm 2023-07-24 09:36:23 +01:00
hns3_dcbnl.c net: hns3: add support config dscp map to tc 2022-09-07 16:20:14 +01:00
hns3_debugfs.c net: hns3: fix strscpy causing content truncation issue 2023-08-10 11:47:56 -07:00
hns3_debugfs.h net: hns3: fix output information incomplete for dumping tx queue info with debugfs 2023-05-13 17:12:23 +01:00
hns3_enet.c net: hns3: fix deadlock issue when externel_lb and reset are executed together 2023-08-08 16:13:05 -07:00
hns3_enet.h net: hns3: support wake on lan configuration and query 2023-03-29 09:07:42 +01:00
hns3_ethtool.c net: hns3: clear hns unused parameter alarm 2023-06-23 10:59:17 +02:00
hns3_ethtool.h net: hns3: refactor hns3_set_ringparam() 2022-04-20 10:45:50 +01:00
hns3_trace.h net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
Makefile net: hns3: create new set of common tqp stats APIs for PF and VF reuse 2022-01-05 14:36:36 +00:00