diff options
author | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2024-04-05 13:27:57 +0200 |
---|---|---|
committer | Fernando Fernandez Mancera <ffmancera@riseup.net> | 2024-04-05 13:27:57 +0200 |
commit | 0bb37455c3328d20dee3e4519ef2b59a5fc7ee0a (patch) | |
tree | e5c56f09aae4a1674b0b27fc848cdec6b2af9cad | |
parent | 628371423b798a0eb28f34962dd44b89c6e26602 (diff) | |
parent | 9ff7ff28fc15f0e34f6f30cbed63907f7b39b46f (diff) |
merge: branch 'bg/fix-compilation'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1911
-rw-r--r-- | src/core/tests/test-dcb.c | 2 | ||||
-rw-r--r-- | src/libnm-core-impl/nm-setting-team.c | 8 | ||||
-rw-r--r-- | src/libnm-core-impl/nm-team-utils.c | 10 | ||||
-rw-r--r-- | src/libnm-glib-aux/nm-uuid.c | 11 |
4 files changed, 8 insertions, 23 deletions
diff --git a/src/core/tests/test-dcb.c b/src/core/tests/test-dcb.c index f85e90f990..33437974d5 100644 --- a/src/core/tests/test-dcb.c +++ b/src/core/tests/test-dcb.c @@ -11,7 +11,7 @@ typedef struct { guint num; - const char *cmds[]; + const char *cmds[16]; } DcbExpected; static gboolean diff --git a/src/libnm-core-impl/nm-setting-team.c b/src/libnm-core-impl/nm-setting-team.c index 191ed9aef6..08364af88f 100644 --- a/src/libnm-core-impl/nm-setting-team.c +++ b/src/libnm-core-impl/nm-setting-team.c @@ -122,19 +122,13 @@ nm_team_link_watcher_new_ethtool(int delay_up, int delay_down, GError **error) return NULL; } - NM_PRAGMA_WARNING_DISABLE("-Warray-bounds") - NM_PRAGMA_WARNING_DISABLE("-Walloc-size") - - watcher = g_malloc(nm_offsetofend(NMTeamLinkWatcher, ethtool)); + watcher = g_malloc(sizeof(NMTeamLinkWatcher)); watcher->ref_count = 1; watcher->type = LINK_WATCHER_ETHTOOL; watcher->ethtool.delay_up = delay_up; watcher->ethtool.delay_down = delay_down; - NM_PRAGMA_WARNING_REENABLE - NM_PRAGMA_WARNING_REENABLE - return watcher; } diff --git a/src/libnm-core-impl/nm-team-utils.c b/src/libnm-core-impl/nm-team-utils.c index 6f2f5dd298..21562163d2 100644 --- a/src/libnm-core-impl/nm-team-utils.c +++ b/src/libnm-core-impl/nm-team-utils.c @@ -2809,16 +2809,8 @@ NMTeamSetting * nm_team_setting_new(gboolean is_port, const char *js_str) { NMTeamSetting *self; - gsize l; - G_STATIC_ASSERT_EXPR(sizeof(*self) == sizeof(self->_data_priv)); - G_STATIC_ASSERT_EXPR( - sizeof(*self) - == NM_MAX(nm_offsetofend(NMTeamSetting, d.master), nm_offsetofend(NMTeamSetting, d.port))); - - l = is_port ? nm_offsetofend(NMTeamSetting, d.port) : nm_offsetofend(NMTeamSetting, d.master); - - self = g_malloc0(l); + self = g_malloc0(sizeof(NMTeamSetting)); self->_data_priv.is_port = is_port; self->_data_priv.strict_validated = TRUE; diff --git a/src/libnm-glib-aux/nm-uuid.c b/src/libnm-glib-aux/nm-uuid.c index 69c34b2b98..e39d2ea563 100644 --- a/src/libnm-glib-aux/nm-uuid.c +++ b/src/libnm-glib-aux/nm-uuid.c @@ -415,8 +415,7 @@ nm_uuid_generate_from_string_str(const char *s, * case the result is different from an empty array. * @len: if negative, @strv is a NULL terminated array. Otherwise, * it is the length of the strv array. In the latter case it may - * also contain NULL strings. The result hashes differently depending - * on whether we have a NULL terminated strv array or given length. + * also contain NULL strings. * * Returns a @uuid_type UUID based on the concatenated C strings. * It does not simply concatenate them, but also includes the @@ -434,9 +433,9 @@ nm_uuid_generate_from_strings_strv(NMUuidType uuid_type, { nm_auto_str_buf NMStrBuf str = NM_STR_BUF_INIT_A(NM_UTILS_GET_NEXT_REALLOC_SIZE_232, TRUE); gsize slen; - const char *s = NULL; + const char *s; - if (len >= 0) { + if (len > 0) { gboolean has_nulls = FALSE; gssize i; @@ -471,14 +470,14 @@ nm_uuid_generate_from_strings_strv(NMUuidType uuid_type, * in the other cases). */ slen = 1; s = "x"; - } else if (!strv[0]) { + } else if (!strv[0] || len == 0) { slen = 0; s = ""; } else if (!strv[1]) { slen = strlen(strv[0]) + 1u; s = strv[0]; } else { - /* We concatenate the NUL termiated string, including the NUL + /* We concatenate the NUL terminated string, including the NUL * character. This way, ("a","a"), ("aa"), ("aa","") all hash * differently. */ for (; strv[0]; strv++) |