mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
net: selftests: use ethtool_sprintf()
During a W=1 build GCC 13.2 says: net/core/selftests.c: In function ‘net_selftest_get_strings’: net/core/selftests.c:404:52: error: ‘%s’ directive output may be truncated writing up to 279 bytes into a region of size 28 [-Werror=format-truncation=] 404 | snprintf(p, ETH_GSTRING_LEN, "%2d. %s", i + 1, | ^~ net/core/selftests.c:404:17: note: ‘snprintf’ output between 5 and 284 bytes into a destination of size 32 404 | snprintf(p, ETH_GSTRING_LEN, "%2d. %s", i + 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 405 | net_selftests[i].name); | ~~~~~~~~~~~~~~~~~~~~~~ avoid it by using ethtool_sprintf(). Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Link: https://lore.kernel.org/r/20231026022916.566661-1-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
6808918343
commit
79fa29570b
@ -397,14 +397,11 @@ EXPORT_SYMBOL_GPL(net_selftest_get_count);
|
|||||||
|
|
||||||
void net_selftest_get_strings(u8 *data)
|
void net_selftest_get_strings(u8 *data)
|
||||||
{
|
{
|
||||||
u8 *p = data;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < net_selftest_get_count(); i++) {
|
for (i = 0; i < net_selftest_get_count(); i++)
|
||||||
snprintf(p, ETH_GSTRING_LEN, "%2d. %s", i + 1,
|
ethtool_sprintf(&data, "%2d. %s", i + 1,
|
||||||
net_selftests[i].name);
|
net_selftests[i].name);
|
||||||
p += ETH_GSTRING_LEN;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(net_selftest_get_strings);
|
EXPORT_SYMBOL_GPL(net_selftest_get_strings);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user