aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-12-09 01:24:54 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-12-09 01:47:13 +0700
commit2376b52da21c2aa06af06f684e4c604980b9c2cf (patch)
tree50310624b692a4e22839ddc09a73df972a41f07f
parent71f96f1b573639dacea3de744fc06e5988d324d6 (diff)
gsm_data: fix wrong variable set in gsm_pchan2chan_nr()
I believe the actual intention was to reset the 'lchan_nr' variable, and not the 'chan_nr'. The 'lchan_nr' is used to compose the 'cbits': cbits = 0x04; cbits += lchan_nr; If the value is 4, then the result is: cbits = 0x04 + 4 = 0x08 which corresponds to SDCCH8 (not SDCCH4), and is clearly wrong. Change-Id: Ic9c7c2e46e24dab0b721221e9adcbbae2ca56d23 Fixes: ec1b5a0e9 "gsm_ts2chan_nr(): add assertions for lchan_nr" Fixes: CID#336586
-rw-r--r--src/osmo-bsc/gsm_data.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c
index 580fa84b0..4d77e7520 100644
--- a/src/osmo-bsc/gsm_data.c
+++ b/src/osmo-bsc/gsm_data.c
@@ -485,8 +485,8 @@ int gsm_pchan2chan_nr(enum gsm_phys_chan_config pchan,
* See osmo-bts-xxx/oml.c:opstart_compl().
*/
if (lchan_nr == CCCH_LCHAN)
- chan_nr = 0;
- else if (lchan_nr >= 4)
+ lchan_nr = 0;
+ else if (lchan_nr > 4)
return -EINVAL;
cbits = 0x04;
cbits += lchan_nr;