Change in osmo-pcu[master]: Check return code of rlcmac decode/encode functions

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Thu Feb 6 12:36:56 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/17086 )

Change subject: Check return code of rlcmac decode/encode functions
......................................................................

Check return code of rlcmac decode/encode functions

Change-Id: Iabcb768bd714680aa768b35c786dea2015d1e451
---
M src/pdch.cpp
M src/tbf.cpp
M tests/rlcmac/RLCMACTest.cpp
M tests/rlcmac/RLCMACTest.ok
M tests/tbf/TbfTest.cpp
5 files changed, 115 insertions(+), 70 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, approved



diff --git a/src/pdch.cpp b/src/pdch.cpp
index e15af2c..f4544b2 100644
--- a/src/pdch.cpp
+++ b/src/pdch.cpp
@@ -175,8 +175,11 @@
 struct msgb *gprs_rlcmac_pdch::packet_paging_request()
 {
 	struct gprs_rlcmac_paging *pag;
+	RlcMacDownlink_t *mac_control_block;
+	bitvec *pag_vec;
 	struct msgb *msg;
 	unsigned wp = 0, len;
+	int rc;
 
 	/* no paging, no message */
 	pag = dequeue_paging();
@@ -191,7 +194,7 @@
 		talloc_free(pag);
 		return NULL;
 	}
-	bitvec *pag_vec = bitvec_alloc(23, tall_pcu_ctx);
+	pag_vec = bitvec_alloc(23, tall_pcu_ctx);
 	if (!pag_vec) {
 		msgb_free(msg);
 		talloc_free(pag);
@@ -240,15 +243,23 @@
 	}
 
 	bitvec_pack(pag_vec, msgb_put(msg, 23));
-	RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
+	mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
 	LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Paging Request +++++++++++++++++++++++++\n");
-	decode_gsm_rlcmac_downlink(pag_vec, mac_control_block);
-	LOGPC(DCSN1, LOGL_NOTICE, "\n");
+	rc = decode_gsm_rlcmac_downlink(pag_vec, mac_control_block);
+	if (rc < 0) {
+		LOGP(DRLCMAC, LOGL_ERROR, "Decoding of Downlink Packet Paging Request failed (%d)\n", rc);
+		goto free_ret;
+	}
 	LOGP(DRLCMAC, LOGL_DEBUG, "------------------------- TX : Packet Paging Request -------------------------\n");
 	bitvec_free(pag_vec);
 	talloc_free(mac_control_block);
-
 	return msg;
+
+free_ret:
+	bitvec_free(pag_vec);
+	talloc_free(mac_control_block);
+	msgb_free(msg);
+	return NULL;
 }
 
 bool gprs_rlcmac_pdch::add_paging(uint8_t chan_needed, const uint8_t *mi, uint8_t mi_len)
@@ -686,6 +697,7 @@
 	bitvec *rlc_block;
 	RlcMacUplink_t *ul_control_block;
 	unsigned len = cs.maxBytesUL();
+	int rc;
 
 	if (!(rlc_block = bitvec_alloc(len, tall_pcu_ctx)))
 		return -ENOMEM;
@@ -693,8 +705,12 @@
 	ul_control_block = (RlcMacUplink_t *)talloc_zero(tall_pcu_ctx, RlcMacUplink_t);
 
 	LOGP(DRLCMAC, LOGL_DEBUG, "+++++++++++++++++++++++++ RX : Uplink Control Block +++++++++++++++++++++++++\n");
-	decode_gsm_rlcmac_uplink(rlc_block, ul_control_block);
-	LOGPC(DCSN1, LOGL_NOTICE, "\n");
+	rc = decode_gsm_rlcmac_uplink(rlc_block, ul_control_block);
+	if(rc < 0) {
+		LOGP(DRLCMACUL, LOGL_ERROR, "Dropping Uplink Control Block with invalid "
+		     "content, decode failed: %d)\n", rc);
+		goto free_ret;
+	}
 	LOGP(DRLCMAC, LOGL_DEBUG, "------------------------- RX : Uplink Control Block -------------------------\n");
 
 	if (ul_control_block->u.MESSAGE_TYPE == MT_PACKET_UPLINK_DUMMY_CONTROL_BLOCK)
@@ -728,9 +744,10 @@
 			"RX: [PCU <- BTS] unknown control block(%d) received\n",
 			ul_control_block->u.MESSAGE_TYPE);
 	}
+free_ret:
 	talloc_free(ul_control_block);
 	bitvec_free(rlc_block);
-	return 1;
+	return rc;
 }
 
 /* received RLC/MAC block from L1 */
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 61d8d58..b852cd2 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -1201,6 +1201,8 @@
 {
 	struct msgb *msg;
 	struct gprs_rlcmac_dl_tbf *new_dl_tbf = NULL;
+	RlcMacDownlink_t *mac_control_block = NULL;
+	bitvec *ass_vec = NULL;
 	int poll_ass_dl = 1;
 	unsigned int rrbp = 0;
 	uint32_t new_poll_fn = 0;
@@ -1264,27 +1266,26 @@
 	msg = msgb_alloc(23, "rlcmac_dl_ass");
 	if (!msg)
 		return NULL;
-	bitvec *ass_vec = bitvec_alloc(23, tall_pcu_ctx);
-	if (!ass_vec) {
-		msgb_free(msg);
-		return NULL;
-	}
+	ass_vec = bitvec_alloc(23, tall_pcu_ctx);
+	if (!ass_vec)
+		goto free_ret;
 	bitvec_unhex(ass_vec, DUMMY_VEC);
 	LOGPTBF(new_dl_tbf, LOGL_INFO, "start Packet Downlink Assignment (PACCH)\n");
-	RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
+	mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
 	Encoding::write_packet_downlink_assignment(mac_control_block,
 		old_tfi_is_valid, m_tfi, (direction == GPRS_RLCMAC_DL_TBF),
 		new_dl_tbf, poll_ass_dl, rrbp,
 		bts_data()->alpha, bts_data()->gamma, -1, 0,
 		is_egprs_enabled());
 	LOGP(DTBF, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Downlink Assignment +++++++++++++++++++++++++\n");
-	encode_gsm_rlcmac_downlink(ass_vec, mac_control_block);
-	LOGPC(DCSN1, LOGL_NOTICE, "\n");
+	rc = encode_gsm_rlcmac_downlink(ass_vec, mac_control_block);
+	if (rc < 0) {
+		LOGP(DTBF, LOGL_ERROR, "Decoding of Packet Downlink Ass failed (%d)\n", rc);
+		goto free_ret;
+	}
 	LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Downlink Assignment -------------------------\n");
 	bts->pkt_dl_assignemnt();
 	bitvec_pack(ass_vec, msgb_put(msg, 23));
-	bitvec_free(ass_vec);
-	talloc_free(mac_control_block);
 
 	if (poll_ass_dl) {
 		set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_DL_ASS);
@@ -1297,7 +1298,15 @@
 
 	}
 
+	bitvec_free(ass_vec);
+	talloc_free(mac_control_block);
 	return msg;
+
+free_ret:
+	bitvec_free(ass_vec);
+	talloc_free(mac_control_block);
+	msgb_free(msg);
+	return NULL;
 }
 
 struct msgb *gprs_rlcmac_tbf::create_packet_access_reject()
@@ -1330,8 +1339,10 @@
 
 struct msgb *gprs_rlcmac_tbf::create_ul_ass(uint32_t fn, uint8_t ts)
 {
-	struct msgb *msg;
+	struct msgb *msg = NULL;
 	struct gprs_rlcmac_ul_tbf *new_tbf = NULL;
+	RlcMacDownlink_t *mac_control_block = NULL;
+	bitvec *ass_vec = NULL;
 	int rc;
 	unsigned int rrbp;
 	uint32_t new_poll_fn;
@@ -1360,29 +1371,37 @@
 	if (!msg)
 		return NULL;
 	LOGPTBF(new_tbf, LOGL_INFO, "start Packet Uplink Assignment (PACCH)\n");
-	bitvec *ass_vec = bitvec_alloc(23, tall_pcu_ctx);
-	if (!ass_vec) {
-		msgb_free(msg);
-		return NULL;
-	}
+	ass_vec = bitvec_alloc(23, tall_pcu_ctx);
+	if (!ass_vec)
+		goto free_ret;
 	bitvec_unhex(ass_vec, DUMMY_VEC);
 	Encoding::write_packet_uplink_assignment(ass_vec, m_tfi,
 		(direction == GPRS_RLCMAC_DL_TBF), tlli(),
 		is_tlli_valid(), new_tbf, 1, rrbp, bts_data()->alpha,
 		bts_data()->gamma, -1, is_egprs_enabled());
 	bitvec_pack(ass_vec, msgb_put(msg, 23));
-	RlcMacDownlink_t * mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
+
+	mac_control_block = (RlcMacDownlink_t *)talloc_zero(tall_pcu_ctx, RlcMacDownlink_t);
 	LOGP(DTBF, LOGL_DEBUG, "+++++++++++++++++++++++++ TX : Packet Uplink Assignment +++++++++++++++++++++++++\n");
-	decode_gsm_rlcmac_downlink(ass_vec, mac_control_block);
-	LOGPC(DCSN1, LOGL_NOTICE, "\n");
+	rc = decode_gsm_rlcmac_downlink(ass_vec, mac_control_block);
+	if (rc < 0) {
+		LOGP(DTBF, LOGL_ERROR, "Decoding of Packet Uplink Ass failed (%d)\n", rc);
+		goto free_ret;
+	}
 	LOGP(DTBF, LOGL_DEBUG, "------------------------- TX : Packet Uplink Assignment -------------------------\n");
 	bts->pkt_ul_assignment();
-	bitvec_free(ass_vec);
-	talloc_free(mac_control_block);
 
 	set_polling(new_poll_fn, ts, GPRS_RLCMAC_POLL_UL_ASS);
 
+	bitvec_free(ass_vec);
+	talloc_free(mac_control_block);
 	return msg;
+
+free_ret:
+	bitvec_free(ass_vec);
+	talloc_free(mac_control_block);
+	msgb_free(msg);
+	return NULL;
 }
 
 void gprs_rlcmac_tbf::free_all(struct gprs_rlcmac_trx *trx)
diff --git a/tests/rlcmac/RLCMACTest.cpp b/tests/rlcmac/RLCMACTest.cpp
index f911b09..04c06cf 100644
--- a/tests/rlcmac/RLCMACTest.cpp
+++ b/tests/rlcmac/RLCMACTest.cpp
@@ -93,6 +93,8 @@
 void testRlcMacDownlink(void *test_ctx)
 {
 	printf("*** %s ***\n", __func__);
+
+	int rc;
 	struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
 	bitvec_unhex(resultVector, DUMMY_VEC);
 
@@ -121,11 +123,11 @@
 		RlcMacDownlink_t data;
 		memset(&data, 0, sizeof(data));
 		cout << "=========Start DECODE===========" << endl;
-		decode_gsm_rlcmac_downlink(vector, &data);
-		cout << "+++++++++Finish DECODE++++++++++" << endl;
+		rc = decode_gsm_rlcmac_downlink(vector, &data);
+		cout << "+++++++++Finish DECODE ("<< rc <<")++++++++++" << endl;
 		cout << "=========Start ENCODE=============" << endl;
-		encode_gsm_rlcmac_downlink(resultVector, &data);
-		cout << "+++++++++Finish ENCODE+++++++++++" << endl;
+		rc = encode_gsm_rlcmac_downlink(resultVector, &data);
+		cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl;
 		cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl;
 		cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl;
 		if (memcmp(vector->data, resultVector->data, 23) == 0)
@@ -143,6 +145,8 @@
 void testRlcMacUplink(void *test_ctx)
 {
 	printf("*** %s ***\n", __func__);
+
+	int rc;
 	struct bitvec *resultVector = bitvec_alloc(23, test_ctx);
 	bitvec_unhex(resultVector, DUMMY_VEC);
 
@@ -167,11 +171,11 @@
 		RlcMacUplink_t data;
 		memset(&data, 0, sizeof(data));
 		cout << "=========Start DECODE===========" << endl;
-		decode_gsm_rlcmac_uplink(vector, &data);
-		cout << "+++++++++Finish DECODE++++++++++" << endl;
+		rc = decode_gsm_rlcmac_uplink(vector, &data);
+		cout << "+++++++++Finish DECODE ("<< rc << ")++++++++++" << endl;
 		cout << "=========Start ENCODE=============" << endl;
-		encode_gsm_rlcmac_uplink(resultVector, &data);
-		cout << "+++++++++Finish ENCODE+++++++++++" << endl;
+		rc = encode_gsm_rlcmac_uplink(resultVector, &data);
+		cout << "+++++++++Finish ENCODE ("<< rc <<")+++++++++++" << endl;
 		cout << "vector1 = " << osmo_hexdump(vector->data, 23) << endl;
 		cout << "vector2 = " << osmo_hexdump(resultVector->data, 23) << endl;
 		if (memcmp(vector->data, resultVector->data, 23) == 0)
@@ -188,9 +192,11 @@
 void testCsnLeftAlignedVarBmpBounds(void *test_ctx)
 {
 	printf("*** %s ***\n", __func__);
+
 	struct msgb *m = msgb_alloc(80, "test");
 	static uint8_t exp[] = { 0x7f, 0xff, 0xff, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 	bitvec *vector = bitvec_alloc(23, test_ctx);
+	int rc;
 
 	bitvec_unhex(vector, "40200bffd161003e0e519ffffffb800000000000000000");
 	RlcMacUplink_t data;
@@ -198,7 +204,8 @@
 
 	EGPRS_AckNack_Desc_t *urbb =
 		&data.u.Egprs_Packet_Downlink_Ack_Nack.EGPRS_AckNack.Desc;
-	decode_gsm_rlcmac_uplink(vector, &data);
+	rc = decode_gsm_rlcmac_uplink(vector, &data);
+	OSMO_ASSERT(rc == 0);
 
 	memcpy(msgb_put(m, 13), urbb->URBB, 13);
 	if (!msgb_eq_data_print(m, exp, 13))
diff --git a/tests/rlcmac/RLCMACTest.ok b/tests/rlcmac/RLCMACTest.ok
index 5793d57..24ea4b7 100644
--- a/tests/rlcmac/RLCMACTest.ok
+++ b/tests/rlcmac/RLCMACTest.ok
@@ -2,81 +2,81 @@
  DOWNLINK 
 vector1 = 4e082500e3f1a81d080820800b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 4e 08 25 00 e3 f1 a8 1d 08 08 20 80 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 48282407a6a07422720100032b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 48 28 24 07 a6 a0 74 22 72 01 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 47240c00400000000000000079eb2ac9402b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b 
 vector2 = 47 24 0c 00 40 00 00 00 00 00 00 00 79 eb 2a c9 40 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 47283c367513ba333004242b2b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 47 28 3c 36 75 13 ba 33 30 04 24 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 400820001a3904df0680efb3300b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 40 08 20 00 1a 39 04 df 06 80 ef b3 30 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 40284f0000001009810c826f4406809dcecb2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b 
 vector2 = 40 28 4f 00 00 00 10 09 81 0c 82 6f 44 06 80 9d ce cb 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 4024030f2f0000000087b0042b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 40 24 03 0f 2f 00 00 00 00 87 b0 04 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 4913e00850884013a8048b2b2b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 49 13 e0 08 50 88 40 13 a8 04 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 49 13 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : FALSE
 vector1 = 412430007fffffffffffffffefd19c7ba12b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b 
 vector2 = 41 24 30 00 7f ff ff ff ff ff ff ff ef d1 9c 7b a1 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 41942b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 41 94 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
@@ -84,41 +84,41 @@
  UPLINK 
 vector1 = 400e1e61d11d2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 40 0e 1e 61 d1 1d 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 400b8020000000000000002480e0032b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 40 0b 80 20 00 00 00 00 00 00 00 24 80 e0 03 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 4016713dc094270ca2ae57ef909006aa0fc0001f80222b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 16 71 3d c0 94 27 0c a2 ae 57 ef 90 90 06 aa 0f c0 00 1f 80 22 2b 
 vector2 = 40 16 71 3d c0 94 27 0c a2 ae 57 ef 90 90 06 aa 0f c0 00 1f 80 22 2b 
 vector1 == vector2 : TRUE
 vector1 = 40200ffc0021ec010b2b2b2b2b2b2b2b2b2b2b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector2 = 40 20 0f fc 00 21 ec 01 0b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
 vector1 = 400a9020000000000000003010012a0800132b2b2b2b2b
 =========Start DECODE===========
-+++++++++Finish DECODE++++++++++
++++++++++Finish DECODE (0)++++++++++
 =========Start ENCODE=============
-+++++++++Finish ENCODE+++++++++++
++++++++++Finish ENCODE (0)+++++++++++
 vector1 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b 
 vector2 = 40 0a 90 20 00 00 00 00 00 00 00 30 10 01 2a 08 00 13 2b 2b 2b 2b 2b 
 vector1 == vector2 : TRUE
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp
index bdbc138..5edb544 100644
--- a/tests/tbf/TbfTest.cpp
+++ b/tests/tbf/TbfTest.cpp
@@ -615,7 +615,7 @@
 
 	rlc_block = bitvec_alloc(23, tall_pcu_ctx);
 
-	encode_gsm_rlcmac_uplink(rlc_block, ulreq);
+	OSMO_ASSERT(encode_gsm_rlcmac_uplink(rlc_block, ulreq) == 0);
 	num_bytes = bitvec_pack(rlc_block, &buf[0]);
 	OSMO_ASSERT(size_t(num_bytes) < sizeof(buf));
 	bitvec_free(rlc_block);
@@ -2511,6 +2511,7 @@
 	RlcMacUplink_t ul_control_block;
 	gprs_rlc_v_b *prlcmvb;
 	gprs_rlc_dl_window *prlcdlwindow;
+	int rc;
 
 	memset(&ul_control_block, 0, sizeof(RlcMacUplink_t));
 
@@ -2557,7 +2558,8 @@
 	bits.data_len = sizeof(bits_data);
 	bits.cur_bit = 0;
 
-	decode_gsm_rlcmac_uplink(block, &ul_control_block);
+	rc = decode_gsm_rlcmac_uplink(block, &ul_control_block);
+	OSMO_ASSERT(rc == 0);
 
 	ack_nack = &ul_control_block.u.Egprs_Packet_Downlink_Ack_Nack;
 

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17086
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: Iabcb768bd714680aa768b35c786dea2015d1e451
Gerrit-Change-Number: 17086
Gerrit-PatchSet: 3
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200206/2b813721/attachment.htm>


More information about the gerrit-log mailing list