fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/35288?usp=email )
Change subject: gsm_data: fix wrong variable set in gsm_pchan2chan_nr() ......................................................................
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 --- M src/osmo-bsc/gsm_data.c 1 file changed, 25 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/88/35288/1
diff --git a/src/osmo-bsc/gsm_data.c b/src/osmo-bsc/gsm_data.c index 580fa84..4d77e75 100644 --- a/src/osmo-bsc/gsm_data.c +++ b/src/osmo-bsc/gsm_data.c @@ -485,8 +485,8 @@ * 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;