unique_ids_test.c: fix coverity ASSERT_SIDE_EFFECT

Do the assignment separately, outside of the assert().

Related: CID#311450
Change-Id: I4490a62f444d5048779c9b184b5f580cecd4c149
This commit is contained in:
Neels Hofmeyr 2023-03-20 18:16:44 +01:00
parent 5db469aa7e
commit 6a2763cfdf
2 changed files with 12 additions and 8 deletions

View File

@ -327,7 +327,8 @@ static void test_skip_used_id(void)
dump_state();
log_assert(s1->up_seid == 1);
log_assert(a = llist_first_entry_or_null(&s1->active_gtp_actions, struct up_gtp_action, entry));
a = llist_first_entry_or_null(&s1->active_gtp_actions, struct up_gtp_action, entry);
log_assert(a);
log_assert(a->kind == UP_GTP_U_TUNMAP);
log_assert(a->tunmap.core.tun.local.teid == 1);
log_assert(a->tunmap.access.tun.local.teid == 2);
@ -345,7 +346,8 @@ static void test_skip_used_id(void)
dump_state();
log_assert(s2->up_seid == 2);
log_assert(a = llist_first_entry_or_null(&s2->active_gtp_actions, struct up_gtp_action, entry));
a = llist_first_entry_or_null(&s2->active_gtp_actions, struct up_gtp_action, entry);
log_assert(a);
log_assert(a->kind == UP_GTP_U_TUNMAP);
log_assert(a->tunmap.core.tun.local.teid == 3);
log_assert(a->tunmap.access.tun.local.teid == 4);
@ -370,7 +372,8 @@ static void test_skip_used_id(void)
dump_state();
log_assert(s3->up_seid == 1);
log_assert(a = llist_first_entry_or_null(&s3->active_gtp_actions, struct up_gtp_action, entry));
a = llist_first_entry_or_null(&s3->active_gtp_actions, struct up_gtp_action, entry);
log_assert(a);
log_assert(a->kind == UP_GTP_U_TUNMAP);
log_assert(a->tunmap.core.tun.local.teid == 1);
log_assert(a->tunmap.access.tun.local.teid == 2);
@ -383,7 +386,8 @@ static void test_skip_used_id(void)
dump_state();
log_assert(s4->up_seid == 3);
log_assert(a = llist_first_entry_or_null(&s4->active_gtp_actions, struct up_gtp_action, entry));
a = llist_first_entry_or_null(&s4->active_gtp_actions, struct up_gtp_action, entry);
log_assert(a);
log_assert(a->kind == UP_GTP_U_TUNMAP);
log_assert(a->tunmap.core.tun.local.teid == 5);
log_assert(a->tunmap.access.tun.local.teid == 6);

View File

@ -95,7 +95,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
| session[ESTABLISHED]: UP-SEID 0x1; chain_id access=1 core=2; local TEID access=0x2 core=0x1
assert(s1->up_seid == 1)
assert(a = llist_first_entry_or_null(&s1->active_gtp_actions, struct up_gtp_action, entry))
assert(a)
assert(a->kind == UP_GTP_U_TUNMAP)
assert(a->tunmap.core.tun.local.teid == 1)
assert(a->tunmap.access.tun.local.teid == 2)
@ -161,7 +161,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
assert(s2->up_seid == 2)
assert(a = llist_first_entry_or_null(&s2->active_gtp_actions, struct up_gtp_action, entry))
assert(a)
assert(a->kind == UP_GTP_U_TUNMAP)
assert(a->tunmap.core.tun.local.teid == 3)
assert(a->tunmap.access.tun.local.teid == 4)
@ -269,7 +269,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
assert(s3->up_seid == 1)
assert(a = llist_first_entry_or_null(&s3->active_gtp_actions, struct up_gtp_action, entry))
assert(a)
assert(a->kind == UP_GTP_U_TUNMAP)
assert(a->tunmap.core.tun.local.teid == 1)
assert(a->tunmap.access.tun.local.teid == 2)
@ -335,7 +335,7 @@ DPEER DEBUG up_peer(1-2-3-4){ASSOCIATED}: Received Event UP_PEER_EV_USE_COUNT_ZE
| session[ESTABLISHED]: UP-SEID 0x2; chain_id access=3 core=4; local TEID access=0x4 core=0x3
assert(s4->up_seid == 3)
assert(a = llist_first_entry_or_null(&s4->active_gtp_actions, struct up_gtp_action, entry))
assert(a)
assert(a->kind == UP_GTP_U_TUNMAP)
assert(a->tunmap.core.tun.local.teid == 5)
assert(a->tunmap.access.tun.local.teid == 6)