laforge submitted this change.
unique_ids_test.c: fix coverity ASSERT_SIDE_EFFECT
Do the assignment separately, outside of the assert().
Related: CID#311450
Change-Id: I4490a62f444d5048779c9b184b5f580cecd4c149
---
M tests/unique_ids/unique_ids_test.c
M tests/unique_ids/unique_ids_test.err
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/tests/unique_ids/unique_ids_test.c b/tests/unique_ids/unique_ids_test.c
index 2120ab4..1a9b2b3 100644
--- a/tests/unique_ids/unique_ids_test.c
+++ b/tests/unique_ids/unique_ids_test.c
@@ -327,7 +327,8 @@
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 @@
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 @@
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 @@
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);
diff --git a/tests/unique_ids/unique_ids_test.err b/tests/unique_ids/unique_ids_test.err
index f9ea23a..d0565c8 100644
--- a/tests/unique_ids/unique_ids_test.err
+++ b/tests/unique_ids/unique_ids_test.err
@@ -95,7 +95,7 @@
| 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 @@
| 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 @@
| 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 @@
| 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)
To view, visit change 32019. To unsubscribe, or for help writing mail filters, visit settings.