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
This commit is contained in:
Max 2017-09-08 12:33:34 +02:00
parent 5a6bcfb797
commit 1962136a33
2 changed files with 8 additions and 0 deletions

View File

@ -23,6 +23,9 @@
#include <stdint.h>
#include <stddef.h>
extern "C" {
#include <osmocom/core/utils.h>
}
class GprsCodingScheme {
public:
@ -236,6 +239,9 @@ inline GprsCodingScheme::Scheme GprsCodingScheme::get_retx_mcs(
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];
}

View File

@ -630,6 +630,8 @@ void GprsMs::update_cs_ul(const pcu_l1_meas *meas)
return;
}
OSMO_ASSERT(current_cs_num > 0);
if (!m_current_cs_ul)
return;