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
This commit is contained in:
Vadim Yanitskiy 2023-12-09 01:24:54 +07:00
parent 71f96f1b57
commit 2376b52da2
1 changed files with 2 additions and 2 deletions

View File

@ -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;