diff options
author | Arnd Bergmann <arnd@arndb.de> | 2021-03-24 14:07:22 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-03-24 18:00:32 -0700 |
commit | 84c7f6c33f42a12eb036ebf0f0e3670799304120 (patch) | |
tree | b3e51e778574b8e4cab59ed56781390683d92c94 /drivers/extcon | |
parent | 5a5586112b929546e16029261a987c9197bfdfa2 (diff) | |
download | linux-84c7f6c33f42a12eb036ebf0f0e3670799304120.tar.bz2 |
hinic: avoid gcc -Wrestrict warning
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>
Diffstat (limited to 'drivers/extcon')
0 files changed, 0 insertions, 0 deletions