mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 03:00:13 +01:00
core: assert for valid arguments in sort_captured_addresses() and _addresses_sort_cmp()
Coverity thinks that the arguments could be %NULL. Add an assertion,
hoping to silence coverity.
(cherry picked from commit 8988a12ade)
This commit is contained in:
parent
ee153744a9
commit
702224ec0b
1 changed files with 6 additions and 0 deletions
|
|
@ -544,6 +544,9 @@ _addresses_sort_cmp (gconstpointer a, gconstpointer b, gpointer user_data)
|
|||
const NMPlatformIP4Address *a2 = NMP_OBJECT_CAST_IP4_ADDRESS (*((const NMPObject **) b));
|
||||
guint32 n1, n2;
|
||||
|
||||
nm_assert (a1);
|
||||
nm_assert (a2);
|
||||
|
||||
/* Sort by address type. For example link local will
|
||||
* be sorted *after* a global address. */
|
||||
p1 = _addresses_sort_cmp_get_prio (a1->address);
|
||||
|
|
@ -577,6 +580,9 @@ sort_captured_addresses (const CList *lst_a, const CList *lst_b, gconstpointer u
|
|||
const NMPlatformIP4Address *addr_a = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_a, NMDedupMultiEntry, lst_entries)->obj);
|
||||
const NMPlatformIP4Address *addr_b = NMP_OBJECT_CAST_IP4_ADDRESS (c_list_entry (lst_b, NMDedupMultiEntry, lst_entries)->obj);
|
||||
|
||||
nm_assert (addr_a);
|
||||
nm_assert (addr_b);
|
||||
|
||||
/* Primary addresses first */
|
||||
return NM_FLAGS_HAS (addr_a->n_ifa_flags, IFA_F_SECONDARY) -
|
||||
NM_FLAGS_HAS (addr_b->n_ifa_flags, IFA_F_SECONDARY);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue