merge: branch 'ih/coverity'

Fix some defects detected by Coverity

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/2174

(cherry picked from commit 95b9b4b678)
This commit is contained in:
Íñigo Huguet 2025-04-07 14:15:27 +00:00 committed by Beniamino Galvani
commit 051a4a27a2
3 changed files with 4 additions and 6 deletions

View file

@ -15088,8 +15088,8 @@ respawn_ping_cb(gpointer user_data)
nm_clear_g_source_inst(&ping_op->watch);
if (!spawn_ping_for_operation(self, ping_op)) {
cleanup_ping_operation(ping_op);
priv->ping_operations = g_list_remove(priv->ping_operations, ping_op);
cleanup_ping_operation(ping_op);
if (g_list_length(priv->ping_operations) == 0) {
ip_check_pre_up(self);
@ -15132,7 +15132,6 @@ ip_check_ping_watch_cb(GPid pid, int status, gpointer user_data)
if (success) {
if (ping_op->ping_addresses_require_all) {
cleanup_ping_operation(ping_op);
priv->ping_operations = g_list_remove(priv->ping_operations, ping_op);
if (g_list_length(priv->ping_operations) == 0) {
_LOGD(ping_op->log_domain,
@ -15142,6 +15141,7 @@ ip_check_ping_watch_cb(GPid pid, int status, gpointer user_data)
nm_clear_g_source_inst(&priv->ping_timeout);
ip_check_pre_up(self);
}
cleanup_ping_operation(ping_op);
} else {
nm_assert(priv->ping_operations);

View file

@ -882,7 +882,7 @@ nm_bond_manager_send_arp(int bond_ifindex,
.sll_protocol = htons(ETH_P_ARP),
.sll_ifindex = bond_ifindex,
};
ARPPacket data;
ARPPacket data = {0};
const guint8 *hwaddr;
gsize hwaddrlen = 0;
nm_auto_close int sockfd = -1;
@ -940,6 +940,7 @@ nm_bond_manager_send_arp(int bond_ifindex,
data.op = htons(ARP_OP_GARP);
memcpy(data.s_addr, hwaddr, hwaddrlen);
memcpy(data.s_hw_addr, hwaddr, hwaddrlen);
memset(data.d_hw_addr, 0xff, ETH_ALEN);
for (int i = 0; i < addrs_len; i++) {
const in_addr_t tmp_addr = addrs_array[i];

View file

@ -1140,8 +1140,6 @@ int n_dhcp4_client_probe_transition_decline(NDhcp4ClientProbe *probe, NDhcp4Inco
r = n_dhcp4_c_connection_send_request(&probe->connection, request, ns_now);
if (r)
return r;
else
request = NULL; /* consumed */
n_dhcp4_client_lease_unlink(probe->current_lease);
probe->current_lease = n_dhcp4_client_lease_unref(probe->current_lease);
@ -1346,7 +1344,6 @@ int n_dhcp4_client_probe_release(NDhcp4ClientProbe *probe) {
probe->state = N_DHCP4_CLIENT_PROBE_STATE_INIT;
n_dhcp4_client_lease_unlink(probe->current_lease);
request_out = NULL;
return 0;
}