[PATCH] osmo-pcu[master]: Assert valid 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/.

Max gerrit-no-reply at lists.osmocom.org
Fri Sep 8 10:51:14 UTC 2017


Hello Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/3893

to look at the new patch set (#2).

Assert valid CS

The coding scheme converted to number make sense only if it's
valid. This is implicitly assumed by the code using this conversion as
non-zero value. Make those assumptions explicit with OSMO_ASSERT().

Change-Id: I8f62627b7b7b89dfa1b0d1a7e71b95b2c40fdffa
Fixes: CID70466
---
M src/gprs_coding_scheme.h
M src/gprs_ms.cpp
2 files changed, 8 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/93/3893/2

diff --git a/src/gprs_coding_scheme.h b/src/gprs_coding_scheme.h
index 3b15372..dfad240 100644
--- a/src/gprs_coding_scheme.h
+++ b/src/gprs_coding_scheme.h
@@ -23,6 +23,9 @@
 #include <stdint.h>
 #include <stddef.h>
 
+extern "C" {
+	#include <osmocom/core/utils.h>
+}
 
 class GprsCodingScheme {
 public:
@@ -236,6 +239,9 @@
 				const GprsCodingScheme demanded_mcs,
 				const unsigned arq_type)
 {
+	OSMO_ASSERT(mcs.to_num() > 0);
+	OSMO_ASSERT(demanded_mcs.to_num() > 0);
+
 	return egprs_mcs_retx_tbl[arq_type][mcs.to_num() - 1]
 			[demanded_mcs.to_num() - 1];
 }
diff --git a/src/gprs_ms.cpp b/src/gprs_ms.cpp
index 66312fa..33d9cad 100644
--- a/src/gprs_ms.cpp
+++ b/src/gprs_ms.cpp
@@ -630,6 +630,8 @@
 		return;
 	}
 
+	OSMO_ASSERT(current_cs_num > 0);
+
 	if (!m_current_cs_ul)
 		return;
 

-- 
To view, visit https://gerrit.osmocom.org/3893
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I8f62627b7b7b89dfa1b0d1a7e71b95b2c40fdffa
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list