aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-10 09:48:12 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-10-27 09:45:28 +0100
commitc79beec8f6cd3976fc92d296ebd0b788997f9ce1 (patch)
treef63a9900b754373160f015ff83afeb9a7908382c
parent058ae12135c2e94de5b949ed4066ae03bb8b8121 (diff)
gbproxy/test: Don't assign a variable within OSMO_ASSERT (Coverity)
Coverity complains about having side effects in OSMO_ASSERT argument expressions. This would be an issue in this case, because that variable is only reference in other OSMO_ASSERT expressions. Nevertheless this patch changes this to assign the variable outside of OSMO_ASSERT. Fixes: Coverity CID 1244239 Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 5aa301b6a..16dbf5b46 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -1557,7 +1557,7 @@ static void test_gbproxy_ra_patching()
struct gbproxy_link_info *link_info;
struct gbproxy_peer *peer;
LLIST_HEAD(rcv_list);
- struct expect_result *er;
+ struct expect_result *expect_res;
OSMO_ASSERT(local_tlli == gprs_tmsi2tlli(ptmsi, TLLI_LOCAL));
@@ -1742,8 +1742,9 @@ static void test_gbproxy_ra_patching()
GPRS_SAPI_GMM, 3,
dtap_act_pdp_ctx_req, sizeof(dtap_act_pdp_ctx_req));
- OSMO_ASSERT(er = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ));
- OSMO_ASSERT(er->parse_ctx.apn_ie_len == gbcfg.core_apn_size + 2);
+ expect_res = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ);
+ OSMO_ASSERT(expect_res != NULL);
+ OSMO_ASSERT(expect_res->parse_ctx.apn_ie_len == gbcfg.core_apn_size + 2);
OSMO_ASSERT(8 == peer->ctrg->ctr[GBPROX_PEER_CTR_RAID_PATCHED_BSS].current);
@@ -1756,8 +1757,9 @@ static void test_gbproxy_ra_patching()
GPRS_SAPI_GMM, 3,
dtap_act_pdp_ctx_req, sizeof(dtap_act_pdp_ctx_req));
- OSMO_ASSERT(er = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ));
- OSMO_ASSERT(er->parse_ctx.apn_ie_len == 0);
+ expect_res = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ);
+ OSMO_ASSERT(expect_res != NULL);
+ OSMO_ASSERT(expect_res->parse_ctx.apn_ie_len == 0);
OSMO_ASSERT(9 == peer->ctrg->ctr[GBPROX_PEER_CTR_RAID_PATCHED_BSS].current);
@@ -1809,8 +1811,9 @@ static void test_gbproxy_ra_patching()
GPRS_SAPI_GMM, 3,
dtap_act_pdp_ctx_req, sizeof(dtap_act_pdp_ctx_req));
- OSMO_ASSERT(er = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ));
- OSMO_ASSERT(er->parse_ctx.apn_ie_len == 0);
+ expect_res = expect_gmm_msg(SGSN_NSEI, 0x1002, GSM48_MT_GSM_ACT_PDP_REQ);
+ OSMO_ASSERT(expect_res != NULL);
+ OSMO_ASSERT(expect_res->parse_ctx.apn_ie_len == 0);
OSMO_ASSERT(13 == peer->ctrg->ctr[GBPROX_PEER_CTR_RAID_PATCHED_BSS].current);