linux-stable/drivers/net/ethernet/huawei/hinic
Kees Cook 1e70212e03 hinic: Replace memcpy() with direct assignment
Under CONFIG_FORTIFY_SOURCE=y and CONFIG_UBSAN_BOUNDS=y, Clang is bugged
here for calculating the size of the destination buffer (0x10 instead of
0x14). This copy is a fixed size (sizeof(struct fw_section_info_st)), with
the source and dest being struct fw_section_info_st, so the memcpy should
be safe, assuming the index is within bounds, which is UBSAN_BOUNDS's
responsibility to figure out.

Avoid the whole thing and just do a direct assignment. This results in
no change to the executable code.

[This is a duplicate of commit 2c0ab32b73 ("hinic: Replace memcpy()
 with direct assignment") which was applied to net-next.]

Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Tom Rix <trix@redhat.com>
Cc: llvm@lists.linux.dev
Link: https://github.com/ClangBuiltLinux/linux/issues/1592
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Link: https://lore.kernel.org/r/20220616052312.292861-1-keescook@chromium.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-06-22 11:04:32 -07:00
..
Kconfig net: hinic: fix DEVLINK build errors 2020-10-03 16:52:19 -07:00
Makefile hinic: add support to query sq info 2020-08-31 12:21:26 -07:00
hinic_common.c
hinic_common.h
hinic_debugfs.c hinic: add support to query function table 2020-08-31 12:21:27 -07:00
hinic_debugfs.h hinic: add support to query function table 2020-08-31 12:21:27 -07:00
hinic_dev.h hinic: add support to query function table 2020-08-31 12:21:27 -07:00
hinic_devlink.c hinic: Replace memcpy() with direct assignment 2022-06-22 11:04:32 -07:00
hinic_devlink.h devlink: Make devlink_register to be void 2021-09-22 14:15:12 +01:00
hinic_ethtool.c ethtool: extend ringparam setting/getting API with rx_buf_len 2021-11-22 12:31:49 +00:00
hinic_hw_api_cmd.c net: huawei: hinic: Use devm_kcalloc() instead of devm_kzalloc() 2021-12-08 18:37:28 -08:00
hinic_hw_api_cmd.h
hinic_hw_cmdq.c net: huawei: hinic: Use devm_kcalloc() instead of devm_kzalloc() 2021-12-08 18:37:28 -08:00
hinic_hw_cmdq.h hinic: add check for mailbox msg from VF 2020-08-04 12:17:06 -07:00
hinic_hw_csr.h
hinic_hw_dev.c net: huawei: hinic: Use devm_kcalloc() instead of devm_kzalloc() 2021-12-08 18:37:28 -08:00
hinic_hw_dev.h hinic: add support to query function table 2020-08-31 12:21:27 -07:00
hinic_hw_eqs.c net: huawei: hinic: Use devm_kcalloc() instead of devm_kzalloc() 2021-12-08 18:37:28 -08:00
hinic_hw_eqs.h hinic: modify irq name 2020-09-18 14:34:24 -07:00
hinic_hw_if.c net: huawei: hinic: Fix wrong function name in comments 2021-05-17 14:12:38 -07:00
hinic_hw_if.h
hinic_hw_io.c net: hinic: Use devm_kcalloc() instead of devm_kzalloc() 2021-12-08 18:37:06 -08:00
hinic_hw_io.h hinic: add support to query sq info 2020-08-31 12:21:26 -07:00
hinic_hw_mbox.c hinic: add check for mailbox msg from VF 2020-08-04 12:17:06 -07:00
hinic_hw_mbox.h hinic: add check for mailbox msg from VF 2020-08-04 12:17:06 -07:00
hinic_hw_mgmt.c net: hinic: add missing destroy_workqueue in hinic_pf_to_mgmt_init 2022-05-16 10:57:00 +01:00
hinic_hw_mgmt.h hinic: add generating mailbox random index support 2020-08-04 12:17:06 -07:00
hinic_hw_qp.c net: huawei: hinic: Fix wrong function name in comments 2021-05-17 14:12:38 -07:00
hinic_hw_qp.h hinic: add support to query rq info 2020-08-31 12:21:27 -07:00
hinic_hw_qp_ctxt.h
hinic_hw_wq.c hinic: Avoid some over memory allocation 2022-05-22 21:47:57 +01:00
hinic_hw_wq.h
hinic_hw_wqe.h
hinic_main.c hinic: Remove useless DMA-32 fallback configuration 2022-01-09 16:52:21 -08:00
hinic_port.c net: hinic: remove unnecessary parentheses 2021-05-13 15:39:10 -07:00
hinic_port.h net: don't include ethtool.h from netdevice.h 2020-11-23 17:27:04 -08:00
hinic_rx.c eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
hinic_rx.h
hinic_sriov.c treewide: Add missing includes masked by cgroup -> bpf dependency 2021-12-03 10:58:13 -08:00
hinic_sriov.h
hinic_tx.c eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
hinic_tx.h