Change in osmo-bsc[master]: om2k: Fix invalid use of linked list when building hopping freq list

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Sat May 9 08:05:22 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18142 )

Change subject: om2k: Fix invalid use of linked list when building hopping freq list
......................................................................

om2k: Fix invalid use of linked list when building hopping freq list

I originally assumed that after a complete scan with llist_for_each_entry
the loop counter would be either NULL or a valid entry. That's just not
the case.

Fixes: CID#210256

Signed-off-by: Sylvain Munaut <tnt at 246tNt.com>
Change-Id: Iad647b74771c4ac406a88effd371ed7748c8847e
---
M src/osmo-bsc/abis_om2000.c
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index c696557..0aea684 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -1452,14 +1452,16 @@
 
 static int put_freq_list(uint8_t *buf, struct gsm_bts_trx_ts *ts, uint16_t arfcn)
 {
-	struct gsm_bts_trx *trx;
+	struct gsm_bts_trx *t, *trx = NULL;
 
 	/* Find the TRX that's configured for that ARFCN */
-	llist_for_each_entry(trx, &ts->trx->bts->trx_list, list)
-		if (trx->arfcn == arfcn)
+	llist_for_each_entry(t, &ts->trx->bts->trx_list, list)
+		if (t->arfcn == arfcn) {
+			trx = t;
 			break;
+		}
 
-	if (!trx || (trx->arfcn != arfcn)) {
+	if (!trx) {
 		LOGP(DNM, LOGL_ERROR, "Trying to use ARFCN %d for hopping with no TRX configured for it", arfcn);
 		return 0;
 	}

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Iad647b74771c4ac406a88effd371ed7748c8847e
Gerrit-Change-Number: 18142
Gerrit-PatchSet: 2
Gerrit-Owner: tnt <tnt at 246tNt.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200509/95e7735a/attachment.htm>


More information about the gerrit-log mailing list