mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
With extra warnings enabled, gcc complains that snprintf should not
take the same buffer as source and destination:
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c: In function 'hinic_set_settings_to_hw':
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:480:9: error: 'snprintf' argument 4 overlaps destination object 'set_link_str' [-Werror=restrict]
480 | err = snprintf(set_link_str, SET_LINK_STR_MAX_LEN,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481 | "%sspeed %d ", set_link_str, speed);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c:464:7: note: destination object referenced by 'restrict'-qualified argument 1 was declared here
464 | char set_link_str[SET_LINK_STR_MAX_LEN] = {0};
Rewrite this to avoid the nested sprintf and instead use separate
buffers, which is simpler.
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||
|---|---|---|
| .. | ||
| hinic_common.c | ||
| hinic_common.h | ||
| hinic_debugfs.c | ||
| hinic_debugfs.h | ||
| hinic_dev.h | ||
| hinic_devlink.c | ||
| hinic_devlink.h | ||
| hinic_ethtool.c | ||
| hinic_hw_api_cmd.c | ||
| hinic_hw_api_cmd.h | ||
| hinic_hw_cmdq.c | ||
| hinic_hw_cmdq.h | ||
| hinic_hw_csr.h | ||
| hinic_hw_dev.c | ||
| hinic_hw_dev.h | ||
| hinic_hw_eqs.c | ||
| hinic_hw_eqs.h | ||
| hinic_hw_if.c | ||
| hinic_hw_if.h | ||
| hinic_hw_io.c | ||
| hinic_hw_io.h | ||
| hinic_hw_mbox.c | ||
| hinic_hw_mbox.h | ||
| hinic_hw_mgmt.c | ||
| hinic_hw_mgmt.h | ||
| hinic_hw_qp_ctxt.h | ||
| hinic_hw_qp.c | ||
| hinic_hw_qp.h | ||
| hinic_hw_wq.c | ||
| hinic_hw_wq.h | ||
| hinic_hw_wqe.h | ||
| hinic_main.c | ||
| hinic_port.c | ||
| hinic_port.h | ||
| hinic_rx.c | ||
| hinic_rx.h | ||
| hinic_sriov.c | ||
| hinic_sriov.h | ||
| hinic_tx.c | ||
| hinic_tx.h | ||
| Kconfig | ||
| Makefile | ||