Change in osmo-bts[master]: l1sap: fix incorrect pointer cast in l1sap_chan_act()

fixeria gerrit-no-reply at lists.osmocom.org
Sun Apr 18 21:57:26 UTC 2021


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/23787 )


Change subject: l1sap: fix incorrect pointer cast in l1sap_chan_act()
......................................................................

l1sap: fix incorrect pointer cast in l1sap_chan_act()

In [1] I introduced a regression, so osmo-bts started to complain:

  This PHY does not support lchan TSC 3 != BSIC-TSC 7

on channel activation, despite the TSC in RSL_IE_CHAN_IDENT was 7.

The problem is that this statement:

  cd = (const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT) + 1;

is basically equivalent to:

  cd = ((const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT)) + 1;

so we actually shift the pointer by sizeof(struct gsm48_chan_desc)
and skip 3 octets instead of just one (IEI octet).  Fix this.

Change-Id: Ic3a81396b60577e03c541d32839d07dc6d45c838
Fixes: [1] Id100f4c56fd5c1adad5d925d97240bed82981b9b
Fixes: OS#5121
---
M src/common/l1sap.c
1 file changed, 1 insertion(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/87/23787/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 7702b23..b74e0d3 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1971,7 +1971,7 @@
 	 * need to make sure ew don't crash here */
 	if (tp && TLVP_PRES_LEN(tp, RSL_IE_CHAN_IDENT, sizeof(*cd) + 1)) {
 		/* Channel Description IE comes together with its IEI (see 9.3.5) */
-		cd = (const struct gsm48_chan_desc *) TLVP_VAL(tp, RSL_IE_CHAN_IDENT) + 1;
+		cd = (const struct gsm48_chan_desc *) (TLVP_VAL(tp, RSL_IE_CHAN_IDENT) + 1);
 
 		/* The PHY may not support using different TSCs */
 		if (!osmo_bts_has_feature(trx->bts->features, BTS_FEAT_MULTI_TSC)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/23787
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic3a81396b60577e03c541d32839d07dc6d45c838
Gerrit-Change-Number: 23787
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210418/e4c997bd/attachment.htm>


More information about the gerrit-log mailing list