merge: branch 'bg/fix-compilation'

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1911
This commit is contained in:
Fernando Fernandez Mancera 2024-04-05 13:27:57 +02:00
commit 0bb37455c3
4 changed files with 8 additions and 23 deletions

View file

@ -11,7 +11,7 @@
typedef struct {
guint num;
const char *cmds[];
const char *cmds[16];
} DcbExpected;
static gboolean

View file

@ -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;
}

View file

@ -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;

View file

@ -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++)