aboutsummaryrefslogtreecommitdiffstats
path: root/src/tbf_dl.cpp
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-12-21 12:11:33 +0100
committerMax <msuraev@sysmocom.de>2018-01-04 16:35:55 +0000
commitb3a17d6074b2575a599863766b9826a7bd3369b9 (patch)
treeb70ed9dfaa6159220ed07c762dc2e05993966495 /src/tbf_dl.cpp
parenta4f570fe7a9e511d04ba3aade4a144b4cb74deb8 (diff)
cosmetic: clarify coding scheme and puncturing
* use appropriate types for coding scheme parameters * add comment regarding possible number of RLCMAC blocks The code in create_dl_acked_block() has underlying assumption that rlc.num_data_blocks can never be more than 2, which is true and is enforced by appropriate asserts but is not obvious when looking at the function code alone. It's equally hard for Coverity which leads to false positives in scan. Lets' make this assumption explicit by putting it into for(;;) condition alongside with corresponding comment. Fixes: CID143070 Change-Id: If599a6c8a6ef56d847604fcf41bb71decccd8a78
Diffstat (limited to 'src/tbf_dl.cpp')
-rw-r--r--src/tbf_dl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tbf_dl.cpp b/src/tbf_dl.cpp
index 58b55dcd..b871bc32 100644
--- a/src/tbf_dl.cpp
+++ b/src/tbf_dl.cpp
@@ -666,7 +666,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
unsigned msg_len;
bool need_poll;
/* TODO: support MCS-7 - MCS-9, where data_block_idx can be 1 */
- unsigned int data_block_idx = 0;
+ uint8_t data_block_idx = 0;
unsigned int rrbp;
uint32_t new_poll_fn;
int rc;
@@ -752,8 +752,8 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
LOGP(DRLCMACDL, LOGL_DEBUG, "- Copying %u RLC blocks, %u BSNs\n", rlc.num_data_blocks, num_bsns);
- /* Copy block(s) to RLC message */
- for (data_block_idx = 0; data_block_idx < rlc.num_data_blocks;
+ /* Copy block(s) to RLC message: the num_data_blocks cannot be more than 2 - see assert above */
+ for (data_block_idx = 0; data_block_idx < OSMO_MIN(rlc.num_data_blocks, 2);
data_block_idx++)
{
int bsn;
@@ -777,7 +777,7 @@ struct msgb *gprs_rlcmac_dl_tbf::create_dl_acked_block(
OSMO_ASSERT(m_rlc.block(bsn)->next_ps >= EGPRS_PS_1);
OSMO_ASSERT(m_rlc.block(bsn)->next_ps <= EGPRS_PS_3);
}
- OSMO_ASSERT(data_block_idx < 2); /* punct defined above as 2-element array */
+
punct[data_block_idx] = m_rlc.block(bsn)->next_ps;
rdbi = &rlc.block_info[data_block_idx];