Change in osmo-pcu[master]: Fix msc_is_valid(): UNKNOWN value is not a valid (M)CS

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
Wed Nov 4 17:34:59 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/21045 )


Change subject: Fix msc_is_valid(): UNKNOWN value is not a valid (M)CS
......................................................................

Fix msc_is_valid(): UNKNOWN value is not a valid (M)CS

Also add a few more asserts to make sure a valid CS/MCS is passed in
some placed where we expect (M)CS to be set.

Change-Id: I0a973e10cd9477f72d8bd47a06048414b33ae96a
---
M src/coding_scheme.c
M src/encoding.cpp
M src/rlc.cpp
3 files changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/45/21045/1

diff --git a/src/coding_scheme.c b/src/coding_scheme.c
index e39ed2b..27241d1 100644
--- a/src/coding_scheme.c
+++ b/src/coding_scheme.c
@@ -163,7 +163,7 @@
 
 bool mcs_is_valid(enum CodingScheme cs)
 {
-	return UNKNOWN <= cs && cs <= MCS9;
+	return UNKNOWN < cs && cs <= MCS9;
 }
 
 bool mcs_is_compat_kind(enum CodingScheme cs, enum mcs_kind mode)
diff --git a/src/encoding.cpp b/src/encoding.cpp
index c6ec2e8..7f5da75 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -1692,6 +1692,7 @@
 
 	LOGP(DRLCMACDL, LOGL_ERROR, "%s data block encoding not implemented\n",
 		mcs_name(cs));
+	OSMO_ASSERT(mcs_is_valid(cs));
 
 	return AR_NEED_MORE_BLOCKS;
 }
diff --git a/src/rlc.cpp b/src/rlc.cpp
index 4f36025..8f56a8e 100644
--- a/src/rlc.cpp
+++ b/src/rlc.cpp
@@ -350,6 +350,7 @@
 void gprs_rlc_data_info_init_dl(struct gprs_rlc_data_info *rlc,
 	enum CodingScheme cs, bool with_padding, const unsigned int spb)
 {
+	OSMO_ASSERT(mcs_is_valid(cs));
 	return gprs_rlc_data_header_init(rlc, cs, with_padding,
 					 num_data_header_bits_DL(mcs_header_type(cs)), spb);
 }
@@ -357,6 +358,7 @@
 void gprs_rlc_data_info_init_ul(struct gprs_rlc_data_info *rlc,
 	enum CodingScheme cs, bool with_padding)
 {
+	OSMO_ASSERT(mcs_is_valid(cs));
 	/*
 	 * last parameter is sent as 0 since common function used
 	 * for both DL and UL

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

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I0a973e10cd9477f72d8bd47a06048414b33ae96a
Gerrit-Change-Number: 21045
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201104/ddf435c8/attachment.htm>


More information about the gerrit-log mailing list