mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 11:48:04 +02:00
libnm: avoid "-Wmaybe-uninitialized" warning in nm_setting_ethtool_get_optnames()
With LTO build on s390x (Fedora 33) we get a compiler warning:
libnm-core/nm-setting-ethtool.c: In function 'nm_setting_ethtool_get_optnames':
libnm-core/nm-setting-ethtool.c:263:60: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
263 | return len > 0 ? nm_memdup(names, sizeof(names[0]) * (((gsize) len) + 1u)) : NULL;
| ^
libnm-core/nm-setting-ethtool.c:257:24: note: 'len' was declared here
257 | guint len;
| ^
libnm-core/nm-setting-ethtool.c: In function 'nm_setting_ethtool_get_optnames':
libnm-core/nm-setting-ethtool.c:263:60: error: 'len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
263 | return len > 0 ? nm_memdup(names, sizeof(names[0]) * (((gsize) len) + 1u)) : NULL;
| ^
libnm-core/nm-setting-ethtool.c:257:24: note: 'len' was declared here
257 | guint len;
| ^
This commit is contained in:
parent
d26fa1cd52
commit
63a33b3542
1 changed files with 1 additions and 1 deletions
|
|
@ -254,7 +254,7 @@ const char **
|
|||
nm_setting_ethtool_get_optnames(NMSettingEthtool *setting, guint *out_length)
|
||||
{
|
||||
const char *const *names;
|
||||
guint len;
|
||||
guint len = 0;
|
||||
|
||||
g_return_val_if_fail(NM_IS_SETTING_ETHTOOL(setting), NULL);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue