mirror_ubuntu-kernels/drivers/net/ethernet/hisilicon/hns3/hns3pf
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
..
hclge_cmd.h net: hns3: support wake on lan configuration and query 2023-03-29 09:07:42 +01:00
hclge_dcb.c net: hns3: fix wrong bw weight of disabled tc issue 2023-07-24 09:36:23 +01:00
hclge_dcb.h
hclge_debugfs.c net: hns3: fix strscpy causing content truncation issue 2023-08-10 11:47:56 -07:00
hclge_debugfs.h net: hns3: refactor two hns3 debugfs functions 2021-11-29 14:26:17 +00:00
hclge_devlink.c devlink: remove devlink features 2023-01-30 08:37:46 +00:00
hclge_devlink.h net: hns3: add support for registering devlink for PF 2021-07-26 12:16:03 +01:00
hclge_err.c net: add missing includes of linux/sched/clock.h 2023-01-27 11:19:46 +00:00
hclge_err.h net: hns3: add error recovery module and type for himac 2021-10-25 14:00:59 +01:00
hclge_main.c net: hns3: add wait until mac link down 2023-08-08 16:13:05 -07:00
hclge_main.h net: hns3: refine the tcam key convert handle 2023-06-23 10:59:17 +02:00
hclge_mbx.c net: hns3: refine the handling for VF heartbeat 2022-12-30 07:32:00 +00:00
hclge_mdio.c net: hns3: add support to query and set lane number by ethtool 2022-09-07 16:20:15 +01:00
hclge_mdio.h net: hns3: fix hns3 driver header file not self-contained issue 2021-12-03 11:01:00 +00:00
hclge_ptp.c ptp: hclge: convert .adjfreq to .adjfine 2022-11-11 10:58:39 +00:00
hclge_ptp.h net: hns3: fix hns3 driver header file not self-contained issue 2021-12-03 11:01:00 +00:00
hclge_tm.c net: hns3: restore user pause configure when disable autoneg 2023-08-08 16:13:05 -07:00
hclge_tm.h net: hns3: restore user pause configure when disable autoneg 2023-08-08 16:13:05 -07:00
hclge_trace.h net: hns3: add byte order conversion for PF to VF mailbox message 2022-05-09 14:30:37 +01:00