Change in osmocom-bb[master]: mobile/gsm322.c: fix: properly print stored BA list entities

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/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Sun Feb 3 09:26:37 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/12782


Change subject: mobile/gsm322.c: fix: properly print stored BA list entities
......................................................................

mobile/gsm322.c: fix: properly print stored BA list entities

As we do iterate over all entities in the BA list, it makes more
sense to print each one separately instead of printing the last
one. Moreover, as soon as the iteration is finished, *ba points
to some zero-initialized part of memory:

  gsm322.c:5170 Write stored BA list (mcc=000 mnc=000  Marshall Islands, 000)

After this patch:

  gsm322.c:5162 Write stored BA list (mcc=250 mnc=99  Russian Federation, Beeline)
  gsm322.c:5162 Write stored BA list (mcc=250 mnc=01  Russian Federation, MegaFon)
  gsm322.c:5162 Write stored BA list (mcc=250 mnc=02  Russian Federation, MTS)
  gsm322.c:5162 Write stored BA list (mcc=544 mnc=31  Serbia, Telenor)

Change-Id: I5160492e6125401c6a1765f54d129b1f1cd503fc
---
M src/host/layer23/src/mobile/gsm322.c
1 file changed, 6 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/82/12782/1

diff --git a/src/host/layer23/src/mobile/gsm322.c b/src/host/layer23/src/mobile/gsm322.c
index f2b51df..7da63e3 100644
--- a/src/host/layer23/src/mobile/gsm322.c
+++ b/src/host/layer23/src/mobile/gsm322.c
@@ -5156,6 +5156,11 @@
 				buf[2] = ba->mnc >> 8;
 				buf[3] = ba->mnc & 0xff;
 
+				LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
+					"mnc=%s  %s, %s)\n", gsm_print_mcc(ba->mcc),
+					gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
+					gsm_get_mnc(ba->mcc, ba->mnc));
+
 				rc += fwrite(buf, 4, 1, fp);
 				rc += fwrite(ba->freq, sizeof(ba->freq), 1, fp);
 			}
@@ -5163,12 +5168,7 @@
 		}
 	}
 
-	if (rc == 2)
-		LOGP(DCS, LOGL_INFO, "Write stored BA list (mcc=%s "
-			"mnc=%s  %s, %s)\n", gsm_print_mcc(ba->mcc),
-			gsm_print_mnc(ba->mnc), gsm_get_mcc(ba->mcc),
-			gsm_get_mnc(ba->mcc, ba->mnc));
-	else
+	if (rc != 2)
 		LOGP(DCS, LOGL_ERROR, "Failed to write BA list\n");
 
 	/* free lists */

-- 
To view, visit https://gerrit.osmocom.org/12782
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5160492e6125401c6a1765f54d129b1f1cd503fc
Gerrit-Change-Number: 12782
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190203/806fc494/attachment.htm>


More information about the gerrit-log mailing list