From 2376b52da21c2aa06af06f684e4c604980b9c2cf Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sat, 9 Dec 2023 01:24:54 +0700 Subject: [PATCH] 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 --- src/osmo-bsc/gsm_data.c | 4 ++-- 1 file 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;