GSM 03.22 bug / unreachable code?

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/baseband-devel@lists.osmocom.org/.

Harald Welte laforge at gnumonks.org
Sat Jul 16 15:33:30 UTC 2011


Hi Andreas,

while using Smatch on layer23, I discovered a potential problem in GSM
03.22: There is a loop with an if-statement, and there might be missing
curly braces.

Do you think this is the correct way to fix it?

diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index 210215e..766ffbf 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -983,9 +983,10 @@ static int gsm322_a_user_resel(struct osmocom_ms *ms, struct msgb *msg)
 	/* search current PLMN in list */
 	llist_for_each_entry(plmn_entry, &plmn->sorted_plmn, entry) {
 		if (plmn_entry->mcc == plmn->mcc
-		 && plmn_entry->mnc == plmn->mnc)
+		 && plmn_entry->mnc == plmn->mnc) {
 			plmn_found = plmn_entry;
 			break;
+		}
 	}
 
 	/* abort if list is empty */

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)




More information about the baseband-devel mailing list